# IF

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
IF expr THEN stmt [: stmt]
IF expr THEN stmt ELSE stmt
IF expression THEN
<statements>
[ELSEIF expression THEN
<statements>]
[ELSE
<statements>]
ENDIF

Description:

IF expr THEN stmt [: stmt]
IF expr THEN stmt ELSE stmt
Evaluates the expression ‘expr' and performs the statement following the THEN keyword if it is true or skips to the next line if false.
If there are more statements on the line (separated by colons (:) they will also be executed if true or skipped if false.
The ELSE keyword is optional and if present only one true statement is allowed following the THEN keyword. If 'expr' is resolved to be false the single statement following the ELSE keyword will be executed.
The ‘THEN statement’ construct can be also replaced with:
GOTO linenumber | label’.
This type of IF statement is all on one line.

IF expression THEN
<statements>
[ELSEIF expression THEN
<statements>]
[ELSE
<statements>]
ENDIF

Multiline IF statement with optional ELSE and ELSEIF cases and ending with ENDIF. Each component is on a separate line.
Evaluates 'expression' and performs the statement(s) following THEN if the expression is true or optionally the statement(s) following the ELSE statement if false.
The ELSEIF statement (if present) is executed if the previous condition is false and it starts a new IF chain with further ELSE and/or ELSEIF statements as required.
One ENDIF is used to terminate the multiline IF.

ENDIF can also be represented by END IF

Last edited: 29 September, 2020