EasyManua.ls Logo

Laser 128 - Goto and if

Laser 128
255 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...
BASIC COMMANDS AND STATEMENTS
3.26
IF
.
GOTO
and
IF
..
.
THEN
..•
Purpose:
To
direct
program
flow
depending
on
the
result
of
an
evaluation.
Format
:
IF
expression
GOTO
linenumber
IF
expr
ession
THEN
statement
Comments:
If
the
ex
pression is
tru
e,
th
e
linenumber
following
GOTO
or
the
statement
following
THEN
is
executed,
otherwi
se
it
is
ignored
and
the
program
continues
with
the
ne
xt
line
.
Example:
NEW
10
INPUT
A, B
20
IF
A < B
GOTO
50
30
PRINT
A;
II
IS
LARGER
THAN
ti
;B
40
GOTO
IO
50
PRINT
A;
ti
IS
SMALLER
THAN
ti
;B
] 60
GOTO
IO
]
RUN
? 32, 22
32 IS
LARGER
THAN
22
? 40, 90
40 IS
SMALLER
THAN
90
In
statement
20, A is
compared
with
B.
If
A is sma
ller
than
B,
statement
50
will
be
executed;
otherwise
pro
g
ram
co
ntinue
s to
statement
30.
II-56

Table of Contents