Syntax |
IF expression [THEN]
.....
[ELSE]
.....
ENDIF
If the result of the expression is non-zero (logical true), the
block of program lines between the THEN and the ELSE statements will be executed. If the
result of the expression is zero (false), the block between the IF and ELSE will be
ignored, and the block between the ELSE and ENDIF statements will be executed instead.
If there is no ELSE statement, and if the result of the expression
is false, the block of program lines between the THEN and the ENDIF statement will be
ignored, but execution will continue right after the ENDIF statement.
Nesting of IF statement
Statement blocks within the IF..THEN..ELSE statement may contain
other IF..THEN..ELSE blocks (nesting). Note that each IF statement must be ended with the
ENDIF statement. Otherwise an error message "IF without ENDIF" will be reported
during compilation.
Testing Equality: Special comparison operators may be used in the
expression of the IF statement. Only integer expression may be compared. For comparison of
strings, please refer to the "STRCMP(A$, B$)" function.
Equal
|
= |
Not Equal
|
<> |
Greater than
|
> |
Less than
|
< |
Greater than or Equal to
|
>= |
Less than or Equal to
|
<= |
|