This program prints the numbers from one to twenty on the screen,
followed by the message BLACKJACK! L = 21.
The end of loop value may be followed by the word STEP and another
number or variable. In this case, the value following the STEP is added
each time instead of one. This allows you to count backwards. by
fractions, or any way necessary.
You can set up loops inside one another. This Is known as nesting
loops. You must be careful to nest loops so that the last loop to start is
the first one to end.
EXAMPLE OF NESTED LOOPS
10 FOR L = 1 TO
100
L
30 NEXT A
r 20 FOR A = 5 TO 11 STEP 2
loop is "nested' Inside
the larger one.
This FOR
NEXT
40 NEXT L
GET
The word GET is followed by a variable name. usually a string variable.
If a numeric were used and any key other than a number was hit, tne
program would stop with an error message. The GET statement may
also be put into a loop, checking for an empty result. which waits for a
key to be struck to continue. The GETKEY statement could also be
used In this case. This command can only be executed within a
program.
EXAMPLE.
10 GET A$:IF AS < > "A" THEN 10
This line waits for the
'A' key to be pressed
to continue
.
GETKEY
GETKEY variable
list
The GETKEY statement is very similar to the GET statement. Unlike
the GET statement, GETKEY waits for the user to type a character on
the keyboard This lets it be used easily to wail for a single character to
be typed.
This command can only be executed within a program.
EXAMPLE:
10 GETKEY AS
This line waits for a key to be
struck. Typing any key will
continue the program
.
GET variable list
The GET statement is a way to gel data from tne keyboard one
character at a time. When me GET is executed, the character that was
typed is received If no character was typed. then a null (empty)
character is returned, and the program continues without waiting for a
key. There is no need to press the 110H1RIM- key, and in fact the
IIETIBUI key can be received with a GET
GET
GET/ file numoetvariable :1st
118
119
Need help?
Do you have a question about the Commodore 16 and is the answer not in the manual?
Questions and answers