Structured Control - IF


IF - Executes the enclosed code if the <expression> is true.

The IF statement has the following syntax:

IF[.size] expression THEN[.extent]
   code
ENDI

or

ELSE - Executes the enclosed code if the expression is false.

IF[.size] expression THEN[.extent]
   code
ELSE[.extent]
   code
ENDI

size - The value B, W, or L, specifying the size of the operand comparison.  These values correspond to the Byte, Word, or Long word data size.
         A size may not be specified when the expression consists of only a condition code.

expression - The expression tested.  For a description of the expression syntax, see the Expression Syntax page.

extent - Optional value S or L, indicating the size of the forward branch to use (short or long).

code - The series of assembly commands executed.

One space should be used to separate each part of the statement.

EXAMPLE

IF.B D0 <LT> #5 THEN.S
   code
ENDI