$if2

Usage: $if2(a1,a2,a3,…)
Category: conditional

Description:

Returns the first non empty argument. Can be used with an arbitrary number of arguments.

Warning

Formatting the code using characters such as spaces, tabs or newlines can affect the result of the function.

Example:

The following statements will return the values indicated:

$set(foo,)
$set(bar,Something)
$if2(%foo%,%bar%,Three)    ==>  "Something"
$if2(,%bar%,Three)         ==>  "Something"
$if2(,%foo%,%bar%,Three)   ==>  "Something"
$if2(%foo%, ,%bar%,Three)  ==>  " "
$if2(%foo%.,%bar%,Three)   ==>  "."
$if2(%foo%,,Three)         ==>  "Three"
$if2(%foo%,,,)             ==>  ""