EasyManua.ls Logo

Commodore 64 - Let; Next

Commodore 64
176 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
10 IF X > 10 THEN END
INPUT
The INPUT statement allows the program to get data from the user,
assigning that data to a variable. The program will stop, print a ques-
tion mark (?) on the screen, and wait for the user to type in the answer
and hit RETURN.
INPUT is followed by a variable name, or a list of variable names,
separated by commas. A message may be placed within quote marks,
before the list of variable names to be INPUT. If more than one variable
is to be INPUT, they must be separated by commas when typed.
10 INPUT "PLEASE ENTER YOUR FIRST NAME ";A$
20 PRINT "ENTER YOUR CODE NUMBER"; : INPUT B
INPUT#
INPUT# is similar to INPUT, but takes data from a previously OPENed
file or device.
10 INPUT#l, A
LET
LETis hardly ever used in programs, since it is optional, but the
statement is the heart of all BASIC programs. The variable name which
is to be assigned the result of a calculation is on the left side of the
equal sign, and the formula on the right.
10LETA=5
20 LETD$ = "HELLO"
I
NEXT
NEXTis always used in conjunction with the FOR statement. When the
program reaches a NEXTstatement, it checks the FOR statement to see
if the limit of the loop has been reached. If the loop is not finished, the
loop variable is increased by the specified STEP value. If the loop is
:::- finished, execution proceeds with the statement following NEXT.
121

Table of Contents

Other manuals for Commodore 64

Related product manuals