IF

PURPOSE:
To provide conditional execution of commands
STATEMENT SYNTAX:
stno IF logex {THEN}command(s){ELSE command(s)} {ENDIF} command(s)
where:
logex = any logical expression.
command(s) = any SM32 command(s)
EXAMPLE:
0010 IF A$="example" THEN PRINT A$
0200 IF X=7 OR X$="SEVEN" THEN GOTO 0100 ELSE RETURN
0300 IF X=7 AND X$="SEVEN" THEN Y=8 ELSE Y=9
1234 IF A=B THEN A=A+1;B=B+2 ELSE A=0 ENDIF; C=0
NOTES:
A logical expression can be defined as follows:
logex=logcomp OR/AND logex
That is a logical expression is a logical comparison optionally followed by an OR or an AND with a logical expression.
A logical comparison can be defined as follows:
logcomp=expr logop expr
or
logcomp= str expr logop expr
That is a logical comparison is an arithmetic expression followed by a logical operator followed by an arithmetic expression or a logical expression is a string expression followed by a logical operator follow by a string expression. The logical operators are as follows:
 =	equal to
 <	less than 
 >	greater than
<>	not equal to
 <= =<	less than or equal to
 >= =>	greater than or equal to
The order of evaluation of the logical expression can be varied by the use of brackets. Bracketing can also make complex logical expressions more readable. All logical expression resolve to either TRUE or FALSE.

If the logical expression is TRUE the commands that would be executed are as follows:
All commands that follow the logical expression until one of the following event occurs:
- an ELSE is executed. The ELSE then skips execution to the ENDIF if present or the end of the statement.
- a ENDIF is executed.
- a GOTO statement is executed.
- the end of the statement is encountered.

If the logical expression is FALSE the commands that would be executed are as follows:
All the commands the that follow the ELSE (if any) until one of the following events occurs:
- a ENDIF is executed.
- a GOTO statement is executed.
- the end of the statement is encountered.