LassoScript Utility
Basics Browse Detail

?| If Else

Tag Link ?| If Else Category Symbol
Type Symbol Source Available No
Support Preferred Version 8.0
Change Unchanged Data Source Any
Output Type Any Security None
Implementation Internal Sets Lasso 8.5, Lasso 8.0

Description

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)).

Syntax

( Conditional ? True Result )

( Conditional ? True Result | False Result )

Parameters

Required Parameters
First Parameter A conditional expression that evaluates to true or false.
Second Parameter The result to be returned if the conditional expression evaluates to true.
Optional Parameters
Third Parameter The optional result to be returned if the conditional expression evaluates to false.

Examples

See the Lasso 8 Language Guide for examples of how to use this tag.