Boolean operations

Pulsar supports boolean operations such as and, or but the syntax is a bit different than in other languages. Instead of operators, you use functions:

{[ if @and(var1, var2) ]}
  Executes when both var1 and var2 == true
{[/]}

You can also chain boolean operations, using functions inside functions:

{[ if @and(var1, @or(var2, var3)) ]}
  Executes when var1 == true and one of var2, var2 == true
{[/]}

The following boolean functions are available:

And

and results to true when all statements were true. and is a variadic function, and it can take as many parameters as you want:

{[ if @and(true, true, true, true, false) ]}
  Never executes because one of the statements was false
{[/]}

Or

or results to true when at least one of the statements is true. or is a variadic function, and it can take as many parameters as you want:

Not

not negates the boolean value, meaning true becomes false and vice versa.

Last updated

Was this helpful?