Execute one or more statements conditionally. You can use a single-line syntax or multiple lines in a block. Not available in expressions.
If condition Then statement If conditionThen statementsEnd
condition is a numeric value or comparison whose value determines the program flow. If condition is true, the statements are executed.
statements are the statements to be executed when condition is true.
If you want to execute more than one statement when condition is true, use the multiline syntax.
This example illustrates various forms of If...Then construction that can be used in a routine:
Function MyTransform(Arg1, Arg2, Arg3) * Then clause occupying a single line only: Reply = 0 ;* default If Arg1 Matches "A..." Then Reply = 1 * Multi-line Then clause: If Len(arg1) > 10 Then Reply += 1 Reply = Arg2 * Reply End * Another style of multiline Then clause: If Len(Arg1) > 20 Then Reply += 2 Reply = Arg3 * Reply End Return(Reply)