EasyManuals Logo
Home>Atari>Desktop>65XE

Atari 65XE User Manual

Atari 65XE
135 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #60 background imageLoading...
Page #60 background image
Making Decisions
and Solving Problems:
IF-THEN,FOR-NEXT
The IF-THEN and FOR-NEXT commands enable you to write programs
that mimic the way humans approach a decision or a problem.
Especially useful for games and logic puzzles, the commands let you,
the programmer, make the choices for the computer.
IF-THEN COMMANDS
To practice the IF-THEN statement, type in the following program:
NEW
1 REM *** BRNPROBE . QZ ***
5 PRINT " "
10 DIM RAIN$ (3)
20 PRINT:PRINT "YES OR NO, IF IT HERE RAINING OUTSIDE,
WOULD YOU GO OUT WITH AN UMBRELLA" ;
30 INPUT RAIN$
40 IF RAIN$ = "YES" THEN PRINT "YOU HAVE A FORMIDABLE IQ . "
50 IF RAIN$="NO" THEN PRINT "YOU ARE A BORN RISK TAKER."
The Brainprobe Quiz evaluates your answer. In line 40, if the answer
stored in the string variable RAIN$ is yes, the computer prints the IQ
message. If the answer is not yes, the computer reads the next line,
line 50, and evaluates the string variable RAIN$ again. If the answer is
NO, the computer prints the risk-taker message. However, if you
answer neither yes nor no, the program just ends. The program has no
instructions for responding to an indefinite answer. Try it out.
One way to encourage an expected reply is to create an infinite loop.
Insert the additional line below:
60 GOTO 20
Evaluating with IF-THEN
Another way to encourage a correct answer is to provide hints. The
following program uses numeric variables to elicit a correct response:
NEW
1 REM *** NUMBER . QZ ***
5 PRINT " "
10 SECRETNUM=INT(RND(0)*10)+1
20 PRINT:PRINT "GUESS A SECRET NUMBER BETWEEN 1 AND 10 ."
55

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Atari 65XE and is the answer not in the manual?

Atari 65XE Specifications

General IconGeneral
BrandAtari
Model65XE
CategoryDesktop
LanguageEnglish

Related product manuals