Contents
- Index
If, Else, ElseIf
The If, Else, amd ElseIf functions provides a conditional response to user input or variable contents.
For example, {If (Var1=5) [The variable is 5]} will type The variable is 5 if the contents of variable 1 is 5.
In response to user input through a dialog box:
{Dialog 3,Confirmation,[Yes,No],Continue?}{If (Var3=YES) [You clicked Yes!{Enter}] Else [You clicked No!]}
This will type You clicked Yes! when you clicked the Yes button and You clicked No! when you clicked the No button.
The compare statement supports > for greater than, < for smaller than, = for equals, and ! for does not equal.
For example, evaluating a number:
{Var2 =?Enter a number}{Var2} {If (Var2<5) [is under 5] ElseIf (Var2>10) [is over 10] Else [is between 5 and 10]}
For example this will type 1 is under 5, or 7 is between 5 and 10, or 12 is over 10 depending on what number you enter.
An example using the ! does not equal comparison:
{Var2 =?Enter a number}{Var2} {If (Var2!5) [is not 5] Else [is 5]}.
For example this will type 1 is not 5, or 5 is 5 depending on what number you enter.