Download Print this page

Commodore 64 User Manual page 54

Hide thumbs Also See for COMMODORE 64:

Advertisement

MORE COLON KEY USES
One other neat trick of the a
n is to save
extra spaces in a BASIC command line where
your computer would ordinarily take them out.
This technique is primarily used by pro
grammers to set subroutines apart. For
instance, type in these three lines and press
RETURN after typing each line.
100 FOR 1= I to 400
110 :71
120 NEXT
Your program lines appear on the screen.
SCREEN 1
FOR and NEXT used together is a quick way
to repeat a command many times, such as line
110.
Here is what this program will do when run:
• The first line establishes the value of I, which
starts at the number 1 and ends at 400
• The second line tells the computer to print
the current value of I
• The last line tells the computer to increment
the value of I by one {1, 2, 3, etc.).
To see how this program works, type the
word RUN and press RETURN. You should see
the numbers 1 through 400 rapidly appear on
the screen in a single column.
SCREENS 2 and 3
Clear the screen now by holding SHIFT and
pressing CLR/HOME. (Do not turn off the com
puter before going on to the next exercise.)
SCREEN 1
You can use the colon to set off a command
line from other program lines.
^
■w
SCREEN 2
When you run the program, numbers
rapidly appear In a single column .. .
SCREEN 3
... ending with the last number specified.
In this case, 400.
•w
LEFT BRACKET/COLON key
52
c

Advertisement

loading

Related Products for Commodore COMMODORE 64

This manual is also suitable for:

Vic 20