Expressions

The set, if, else, elseif, and while commands can process mathematical and logical expressions. Each expression can be one operand or two operand and an operator. Each operand can be a variable, and integer, or an expression in parenthesis. An operator is one of: +, -, *, /, % (modulo), & (bitwise and), && (logical and), | (bitwise or), || (logical or), >, <, >=, <=, = (or ==), or !=. Arrays can be used by putting an index (either a number of another variable) inside of []s.
Usage:
(operand operator operand)
Examples:
#set x = ((2 * 3) + 5 + 2)
#set y = ((4 * 2 * 3) / (1 + 3))
#if ((x * 2) > (y-1)) {flee}
#set d = (!a || (b && c))
#set d = !(a && (!b || !c))
#set Index = 0
#set Array[Index] Orc
say Watch out for the %Array[Index]%
Notes:
The expressions must have preceding parantheses to be able to process order of operations correctly. For example,
#set g = 2 * 3 + 4 * 5
would produce
Variable 'g' is set to: 50
but
#set g = (2 * 3) + (4 * 5)
would produce
Variable 'g' is set to: 26.
See Also: If, Else, ElseIf, While, Set