Controlling Expression Evaluation

Parentheses can be used to control the order of operation for evaluating expressions.

Example 1

In this scenario, free shipping should only be offered to bronze or silver members who spend over $500.


var @statusTier, @amount, @freeShipping
set @statusTier = "Bronze"
set @amount = 300

if @statusTier == "Bronze" or @statusTier == "Silver" and @amount > 500 then
  set @freeShipping = true


<p>You %%=Iif(@freeShipping == true, "qualify","do not qualify")=%% for free shipping.</p>


The join operators in the above if statement will be evaluated as a single expression and will produce the following result:

<p>You qualify for free shipping.</p>

Example 2

By modifying the first example to include parentheses, the expression evaluation can be controlled into two expressions.

Not a subscriber? Subscribe now.