The positive (+) and negative (-) operations must precede the operand. The result of a positive operation is the absolute value of the operand. The result of a negative operation is the negative value of the operand; that is, a +(-5) becomes 5 and a -(-2) becomes 2. These operators have the same precedence as the increment and decrement operators. If there is an operand on both sides of these operators, they are interpreted as the add and subtract operators.
Example
<# local_abs := +local #> <# local_neg := -local #>
All operations are performed in the order implied by the precedence of the operators. However, you can modify this order by using parentheses (( )) to group operands and operators. Operations within parentheses are performed first. The result is that of the operations within the parentheses.
Example
<# 4 % (3 + 12) - 6 #>The result is -6 <# 5 && 2 > 1 #>The result is 1 <# (5 && 2) > 1 #>The result is 0
Results of control expressions are written to the output stream when the expression consists of the following:
|
assignment |
predecrement |
postdecrement |
while |
|
if |
preincrement |
postincrement |
|
Example
<# localvar #>value of localvar is written <# " any string" #>“ any string” written <# 4 % 3 + 12 - 6 #>“ 7” is written <# 4 % (3 + 12) - 6 #>“ -6” is written <# i := i + 1 #>nothing is written <# count := (count - 2) #>nothing is written