If
If>expression[,true_label_name[,false_label_name]]
statements
[ [Else
else statements]
Endif ]
Evaluates expression. If the expression is true the first statements are executed. If the expression is false the statements after Else are executed. Else is optional. IF blocks can be nested. When label names are provided execution of the script jumps to the specified labels or subroutine names. If label names are specified Else and Endif are ignored and are unnecessary.
The expression can be simple (legacy), or complex.
Complex Expressions
The expression must be contained within curly braces "{" and "}". String literals must be delimited with double quotes ("), e.g.:
"string". Variables must be delimited with % symbols, e.g.: %VarA%.
Several types of operators and functions can be used with complex expressions. For more details see Complex Expressions.
Simple Expressions
Simple expressions can contain only two parts separated by one of the following operators:
= Equals
> Greater than
< Less than
<> Not Equal
Values in the expression can be numeric or string values, or variables containing such values. Spaces must not be used as simple expressions do not require string delimiters.
See also: SkipLabel | Assigned | EndWhile | END | Exit | Goto | Gosub | IfNot | Include | IncludeFromVar | Label | Let | Macro | OnEvent | Remark | Repeat | SRT | Until | Wait | WaitReady | While
Example
Let>a=5
//simple expression only
IF>a=5
//do something
ELSE
//do something else
ENDIF
//complex expression:
IF>{(%a% = 5) AND (%VarA% = "allen")}
//do something
ELSE
//do something else
ENDIF
//using labels
Label>Start
..
..
..
If>a<b,Start