Chapter 16: Programming
282
If A<7:A+1
!
A
or
If N=1 and M=1:Goto Z
If
Use
If
for testing and branching. If
condition
is false (zero), then the
command
immediately following
If
is skipped. If
condition
is true (nonzero), then the next
command
is executed.
If
instructions can be
nested.
:If
condition
:
command
(if true)
:
command
Program
Output
If-Then
Then
following an
If
executes a group of
commands
if
condition
is true (nonzero).
End
identifies the
end of the group of
commands
.
:If
condition
:Then
:
command
(if true)
:
command
(if true)
:End
:
command
Program
Output
If-Then-Else
Else
following
If-Then
executes a group of
commands
if
condition
is false (zero).
End
identifies the end
of the group of
commands
.
:If
condition
:Then