@ELSEIF

Used between a @IF and a @ENDIF to add another conditional section. The section is only considered if all preceding @IF and @ELSEIF’s conditions were false. There can be multiple @ELSEIF after a @IF.

Usage

<# @ELSEIF(condition) #>

Examples

Example With these variables Result

Text before.
<# @IF(age < 18) #>
A minor
<# @ELSEIF(age < 25) #>
A young adult
<# @ELSE #>
An adult
<# @ENDIF #>

age is 23

Text before.
A young adult

Text before.
<# @IF(age < 18) #>
A minor
<# @ELSEIF(age < 25) #>
A young adult
<# @ELSE #>
An adult
<# @ENDIF #>

age is 30

Text before.
An adult

More information

The examples spread the content and the commands on multiple lines to make it easier to read. This is not required.

There can be multiple @ELSEIF between @IF and @ENDIF, they are evaluated in order and the first one to be true is the only one to have its content displayed.

An @ELSE action can also be placed after all the @IF and @ELSEIF. If every condition of the @IF and @ELSEIF are false, then the content after the @ELSE will be displayed.

A more in-depth explanation for using @IF (and @ELSEIF) is available in the explanations: Clarifying @IF.

See also