EasyManua.ls Logo

Commodore 64 - Gosub; Goto or Go to

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...
..-
GET is followed by a variable name, usually a string variable. If a
numeric variable was used and a nonnumeric key depressed, the pro-
gram would halt with an error message. The GET statement may be
placed into a loop, checking for any empty result. This loop will continue
until a key is hit.
1" GETA$: IFA$ ="" THEN1"
GET#
ThfW:ZEJ...#statement is used with a previously OPENed device or file,
to input one character at a time from that device or file.
GET #1 ,A$
This would input one character from a data file.
GOSUB
This statement is similar to GOTO, except the computer remembers
which program line it last executed before the GOSUB. When a line with
a RETURN statement is encountered, the program jumps back to the
statement immediately following the GOSUB. This is useful if there is a
routine in your program that occurs in several parts of the program.
Instead of typing the routine over and over, execute GOSUBs each time
the routine is needed.
2" GOSUB8""
GOTO OR GO TO
When astatement with the GOTO command is reached, the next line
to be executed will be the one with the line number following the word
GOTO.
IF. . .THEN
IF.. .THENlets the computer analyze a situation and take two possi-
ble courses of action, depending on the outcome. If the expression is
true, the statement following THENis executed. Thismay be any BASIC
statement.
If the expression is false, the program goes directly to the next line.
The expression being evaluated may be a variable or formula, in
which case it is considered true if nonzero, and false if zero. In most
cases, there is an expression involving relational operators (=, <, >,
<=, >=, <>, AND, OR, NOT).
120

Table of Contents

Other manuals for Commodore 64

Related product manuals