BlitzMax/Language/Expressions

Operators
BlitzMax supports the following operators. Operators are grouped into levels of precedence, starting with the highest precedence operators:

In addition, the following built in functions are also supported:

Null returns 0, an empty string, an empty array, the null object or a pointer to 0 depending on context.

True and False are integer constants with the values 1 and 0, respectively.

The index operator can be used on either arrays or strings. If used on an array, the element at the specified index is returned. If used on a string, the character code of the character at the specified index is returned.

The Not operator 'inverts' the logic of a boolean expression. If the expression evaluates to true, Not returns false and vice versa.

Asc returns the character value of the first character of a string, or -1 if the length of the string is 0.

Chr constructs a 1 character string with the specified character value.

Len can be used with either a string or array. When used with a string, Len returns the number of characters in the string. When used with an array, Len returns the number of elements in the array. In the case of multidimensional arrays, Len returns the total number of elements.

Boolean expressions
It is frequently necessary to consider an expression as 'true' or 'false', for example, for use with an If statement.

The rules for determining whether an expression is true or false are: