You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

if()

Usage

if(condition, trueExpression, falseExpression)

Description
Evaluates the given condition and executes trueExpression or falseExpression depending on the evaluation result. This method is often used in HTML attributes, for example to conditionally enable / disable CSS classes etc.

Example

${if(me.isAdmin, 'You have admin rights.', 'You do not have admin rights.')}

results in

You have admin rights.

Search results for "if()"

if()

Evaluates the given condition and executes trueExpression or falseExpression depending on the evaluation result. This method is often used in HTML attributes, for example to conditionally enable / disable CSS classes etc. To do this, you can enter a value of null in either trueExpression or falseExpression.

The is() function is a shortcut for if(condition, trueExpression, null).

if(condition, trueExpression, falseExpression)