ElseIf

An IF statement with an ELSEIF condition is the most complicated type of IF statement:

An ELSEIF statement is considered part of the same IF statement. Only one END keyword is needed to end an IF, ELSEIF, ELSE statement. IF statements can be nested inside other IF statements. A nested IF statement requires its own END keyword. A missing or mismatched keyword results in a runtime syntax error.

Example

Here is a sample IF statement with ELSEIF condition:

IF (@("FirstAmount") < 1000.00)
    $FinalAmount = @("FirstAmount") * .05;
ELSEIF @("FirstAmount") < 5000.00
    $FinalAmount = @("FirstAmount") * .03;
ELSEIF @("FirstAmount") < 10000.00
    $FinalAmount = @("FirstAmount") * .02;
ELSE
    $FinalAmount = @("FirstAmount") + 10.00;
END;
RETURN ($FinalAmount)

If the value of the section variable field FirstAmount is less than 1000.00 then the amount is multiplied by .05 and entered in the target variable $FinalAmount.

See also