Atari XL Handbook page 31

Table of Contents

Advertisement

Programming
120
DRAWTO Y2, 180+DIAM-Y
130
NEXT X
140
NEXT Y
200
FOR T=l TO 1000: NEXT T
210
FOR C=O TO 15
220
SETCOLOR 4,C,O
230
FOR T=l TO 500: NEXT T
240
NEXT C
250
GOTO 210
21
ARITHMETIC IN
PROGRAMS -
VARIABLES
We discovered in Chapter 3 that the Atari will
print the answers to arithmetical problems in
response to commands such as:
PRINT 3+5
This sort of instruction can be included In a
program like this:
10
PRINT" ","
20
PRINT "3+5 = "; 3+5
but it would be difficult to make much use of this
for working out your personal finances.
What gives a computer the power to perform
complex data processing (or (number crunching')
tasks is its ability to do algebra: to use names as
symbols for numbers. This means that programs
can be written with names to symbolise numbers, .
and then RUN with different numbers attached to
the names.
These number-names are called
VARIABLES because they represent varying
numbers. Let's try an example:
The area of a rectangle is equal to the width of the
rectangle multiplied by the height.
By using

Advertisement

Table of Contents
loading

Table of Contents