EasyManuals Logo

Atari 130XE User Manual

Atari 130XE
142 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 #62 background imageLoading...
Page #62 background image
30
PRINT
40
PRINT
"VOUR
GUESS";
50
INPUT
GUESS
60
PRINT
70
IF
GUESS=SECRETNUM
THEN
PRINT
"VOU
GOT
IT!":
END
80
IF
GUESS(SECRETNUM
THEN
PRINT
"TOO
LOW.
TRV
tlGtlIN.
" :
GOTO
40
'JO
IF
GUESS)SECRETNUM
THEN
PRINT
"TOO
HIGH.
TRV
tlGtlIN.
" :
GOTO
40
Lin
es
80 and 90 eva
lu
ate the guess
as
greater than or less than the
secret number. The
PRI
NT
statement provides a hint that the next
guess
should
be
higher or lower. The
GOTO
commands
in
lines 80 and
90 create
an
infinite loop if you continue to guess incorrectly.
Ending the Program
The Number Quiz
is
programmed to stop
on
ly when you discover the
secret number. When you enter the correct answer,
line 70 gives the
computer the instruction to end.
EN
D stops the program, and the
Ready prompt appears
on
your screen.
Trapping Errors
If you accidentally enter a letter instead of a number for GUESS, the
computer sends
an
Error message, and the program ends abruptly.
Make
an
intentional error by typing a letter key or pressing the I Return I
key only. To avoid ending the program, you can use a TRAP command
to trap the Error message. Add the
lin
es
below and run the program
again:
45
TRtlP
100
100
PRINT:
PRINT"
PLEtlSE
ENTER
tl
NUMBER
ONL
V . "
110
GOTO
30
In
line 45, the TRAP command tells the computer not to stop the
program when a mistake is entered and sends the computer to
line
100.
Line 100 tells the computer to print the directions for correcting
the mistake. Line 110 returns the computer to the
place where it left
off. The TRAP statement always comes before the I N PUT statement,
and it
always contains the number of the line that will resolve the
problem.
Quiz Writing with IF-THEN
A program can easi
ly
provide hints when the correct answer
is
a
number,
including a date.
Th
e following program uses IF-THEN
statements and the TRAP command to evaluate guesses:
56

Table of Contents

Other manuals for Atari 130XE

Questions and Answers:

Question and Answer IconNeed help?

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

Atari 130XE Specifications

General IconGeneral
TypeHome computer
Release year1985
CPUMOS Technology 6502C
CPU Speed1.79 MHz
RAM128 KB
ROM24 KB
GraphicsANTIC and GTIA chips
ManufacturerAtari
Display resolution320x192
SoundPOKEY chip, 4 channels
StorageExternal floppy disk drive, cassette tape
Ports2 joystick ports
Operating SystemAtari BASIC

Related product manuals