Operators

Most binary operators are the same as in C. Operator precedence is the same as C. You can also use parentheses to group expressions.

Table 6.3: Operators

Operator

Meaning

+ and -

add and subtract

* and /

multiply and divide

!

Invert or “Not”. E.g. !True equals False.

++i and i++

pre and post increment

--i and i--

pre and post decrement

||

logical OR operation

&&

logical AND operation

!=

logical NOT EQUAL operation

==

logical EQUAL operation

<

less than

>

greater than

<=

less than or equal to

>=

greater than or equal to

#

string concatenation

"@var@"

variable expansion. used inside of quoted strings to expand a variable in the string.

Since variables may contain non-numeric values, relational operators are treated thus:

Table 6.4: Relational Operators for Strings

Operator

Meaning

==

strings must be equal (case sensitive)

!=

strings must not be equal (case sensitive)

<
>
<=
>=

strings are converted to numbers and then compared. Empty strings or strings that are non-numeric result in a runtime error.