else

The else statement works together with the if statement to specify statements that will be executed for both the true and false cases.


Parameters

No parameters.


Description

The else statement turns the if statement into a two way operation: if true, do this, otherwise, do that. You could do this with two if statements in a row, but the else is simpler.

To use the else statement, place it between the if and endif statements. If the true/false formula is true, Panorama will perform the statements from the ifup to the else and skip the statements from the else up to the endif. If the true/false formula is false, Panorama will skip the statements from the if up to the else and perform the statements from the else up to the endif.

The example below calculates sales tax and shipping for both in-state and out-of-state purchases.

if State="CA"
    SalesTax=0.08
    Shipping=2.50
else
    SalesTax=0
    Shipping=5.00
endif

If the state is California, the sales tax is 8% and shipping is $2.50. But if the purchase is from any other state, the sales tax is zero and shipping is $5.00. In this example more or less the same statements are used in both halves of the if/else, but this is not necessary. The two sections could be completely different.


Error Messages

IF or ELSE without ENDIF – Each ELSE statement must be paired with a corresponding ENDIF statement. If this error message appears, the necessary endif statement has not been included.

ELSE does not have a matching IF statement – Each ELSE statement must be paired with a corresponding IF statement. If this error message appears, the necessary if statement has not been included.


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.