?| If Else

Symbol

Symbol

Preferred

8.0

The ternary if else symbol can be used to evaluate a conditional within an expression. The tag is used as ( conditional ? true result | false result ). If the conditional expression evaluates to true then the true result is returned. Otherwise, the false result is returned.

If the | symbol and the false part are omitted then null will be returned as a false result.

The expression in true result or false result will only be evaluated if that result is going to be returned. This allows the ?| symbol to be used for conditional tag execution. A tag can be executed only if it exists: ((Lasso_TagExists: 'mytag') ? (mytag)). Or, a member tag can be executed only if a variable is of the right type: ($var->(Isa: 'array') ? $var->(join: ',') | (string: $var)).

( Conditional ? True Result )

( Conditional ? True Result | False Result )

?| If Else