An expression is a segment of code that evaluates to a value (which has a type). Most statements require the use of expressions and variable declarations can be initialized to the value of an expression. Expressions can be arbitrarily nested within other expressions. This section describes the available expressions in JASS.
expression + expression expression - expression expression * expression expression / expression - expression + expression
These expressions perform addition, subtraction, multiplication, and division on their two operands, and negation and identity on a single operand respectively. Multiplication and division have higher precedence than addition and subtraction; each pair has equal precedence, and they are evaluated left to right. Thus:
a + b * c - d / e
Is equivalent to:
( a + (b * c) ) - (d / e)
Operands must either be integers or reals. If any operand is real, then the result is real, otherwise the result is an integer.
expression == expression expression != expression expression >= expression expression <= expression expression > expression expression < expression
These expressions evaluate equality, inequality, greater than or equal to, less than or equal to, strictly greater than, and strictly less than, respectively.
The operands to
The other four inequality operators can only take integers and reals as arguments. They return a boolean value indicating whether the inequality was satisfied.
expression and expression expression or expression not expressionThese expressions return the boolean and, or, and not of their operator(s). The expressions must evaluate to booleans. These have the least precedence, so:
a == b and c > d + e or fIs equivalent to:
( (a == b) and (c > d + e) ) or f
expression + expression
This is similar to the
This expression evalues to an element in an array variable.
This expression is used to refer to a function. It returns a "pointer"
to that function of type
This trivial expression evaluates to the value of a variable. Variable names are composed of alphanumeric characters and underscores but must start with a letter and can not end with an underscore.
Constant values can be expressed for integers, reals, booleans, and stings.
In addition, the constant value
Integer constants are expressed as 32-bit twos-complement integral numbers.
Real constants are expressed as 32-bit floating point numbers. For example,
Boolean constants are
String constants are declared enclosed in double-quotes like
By enclosing an expression in parenthesis, it is given higher precedence than the immediately surrounding expression. For example:
(1 * (2 + 3) != a) == (b or GetSomeBoolean())Causes the
|Copyright (c) 2003 Jeff Pang
Not affiliated or endorsed by Blizzard Entertainment