Commodore 2001-8 User Manual page 132

Table of Contents

Advertisement

50 RETURN
Causes a subroutine to return to the
statement after the most recently executed
GOSUB.
GOTO
50 GOTO 100
Branches to the statement specified.
Keeping line numbers low will save space
on GOSUB statements.
IF...GOTO
32 IF x< = Y
+
23x4 GOTO 92
Equivalent to IF...THEN, except that IF...
GOTO must be followed by a line number,
while IF...THEN can be followed by either a
line number or another statement.
IF...THEN
151F x<O THEN 5
Branches to specified statement if the
relation is True.
251F X=5THEN 50:Z=A
WARNING. The "Z=A" will never be
executed because if the relation is true,
BASTC will branch to line 50. If the relation
is a false, BASIC will proceed to the line
after line 25.
26 IF X<O THEN PRINT "ERROR X NEGATIVE": GOTO 350
In this example, if X is less than 0, the
PRINT statement will be executed and then
the GOTO statement will branch to line
350.
If
the X was 0 or positive, BASIC will
proceed to execute the lines after line 26.
Binary floating point representations of
decimal fractions may not alwys be exact.
sometimes a comparison will fail because
of this. In this case, compare the number to
INPUT
3 INPUT V,W,W2
B·4
a
±
range.
Request information character by character
until carriage return from the keyboard,
turning the characters into numbers or
strings of a maximum length of 79
characters.
Requests data from the terminal (to be
typed in). Each value must be separated
from the preceeding value by a comma (,).
The last value typed should be followed by
a carriage return. A "?" is typed as a
prompt character. However, only constants
may be typed in as a response to an
INPUT statement, such as 4.5E-3 or "CAT".
If more data was requested in an INPUT
statement than was typed in, a"??" is
printed (if INPUT is from terminal) and the
rest of the data should be typed in. If more

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pet 2001-8

Table of Contents