Chapter 16: Programming
283
:
command
(if true)
:
command
(if true)
:Else
:
command
(if false)
:
command
(if false)
:End
:
command
Program
Output
Note
: In OS 2.53MP and higher, the program name displays again when you press
Í
to repeat
the program.
For(
For(
loops and increments. It increments
variable
from
begin
to
end
by
increment
.
increment
is optional
(default is 1) and can be negative (
end
<
begin
).
end
is a maximum or minimum value not to be
exceeded.
End
identifies the end of the loop.
For(
loops can be nested.
:For(
variable
,
begin
,
end
[
,
increment
]
)
:
command
(while
end
not exceeded)
:
command
(while
end
not exceeded)
:End
:
command
Program
Output
While
While
performs a group of
commands
while
condition
is true.
condition
is frequently a relational test
(Chapter 2).
condition
is tested when
While
is encountered. If
condition
is true (nonzero), the program
executes a group of
commands
.
End
signifies the end of the group. When
condition
is false (zero), the
program executes each
command
following
End
.
While
instructions can be nested.
:While
condition
:
command
(while
condition
is true)