If...Else Statements

Execute one or more statements conditionally. You can use a single-line syntax or multiple lines in a block. Not available in expressions.

Syntax

If condition Else statement
If condition  Else   statements  End

condition is a numeric value or comparison whose value determines the program flow. If condition is false, the statements are executed.

statements are the statements to be executed when condition is false.

Remarks

If you want to execute more than one statement when condition is false, use the multiline syntax.

Example

Function MyTransform(Arg1, Arg2, Arg3)
* Else clause occupying a single line only:
   Reply = 0               ;* default
   If Arg1 Matches "A..." 
   Else Reply = 2
* Multi-line Else clause: 
   If Len(arg1) > 10 Else
      Reply += 2
      Reply = (Arg2 - 1) * Reply
   End
* Another style of multiline Else clause:
   If Len(Arg1) > 20 
   Else
      Reply += 4
      Reply = (Arg3 - 1) * Reply
   End
Return(Reply)