Choice

Choosing between two alternatives depending on a condition is written in Elan as:


#litout1696#

If the condition evaluates to true, then the paragraph between <#1508#>THEN<#1508#> and <#1509#>ELSE<#1509#> (the ``then-part'') is executed, and the rest up to the <#1510#>FI<#1510#> skipped. In the contrary case, the then-part is skipped, and the paragraph between <#1511#>ELSE<#1511#> and <#1512#>FI<#1512#> is executed (the ``else-part''). The keyword <#1513#>FI<#1513#> may also be spelled as <#1514#>ENDIF<#1514#>.

This primary form of choice has two variations for common needs. If there is nothing to do in the else-part, then the choice can be simplified by leaving out the else-part:


#litout1698#

In case the weather is fine you do nothing (<#1517#>ELSE do nothing<#1517#> was omitted). For decision cascades like


#litout1700#

Elan offers another variant of the choice construction:


#litout1702#

Also in this case, an empty else-part may be omitted.