There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.
Close

Processing...
This may take a few seconds.

if-var

Syntax

if-var: variable [value];

variable = a variable in the current scope or the window scope. A current scope variable takes precedence over a window scoped variable. This parameter must be a variable.

value (optional) = the value to compare. This can currently only be true, false, a string, a number or an array. Javascript expressions are allowed if using the {= ... =} wrapper.

This conditional action will return true if an Active CSS variable in the current scope, or window[variable] equals the value.

It will attempt to do a strict comparison, so if the value is a string it must be wrapped in double-quotes.

If there is no value to compare, ie. there is only the variable present, the result will be compared to true.

Examples:

if-var: $player "X";

#myButton:if-var($player "X"):click {
...
}

if-var: $myBoolean {= ($name == "Dave") ? true : false =};

#myButton:if-var($myBoolean):click {
...
}