Expressions determine how a new value is calculated on the basis of specified values. The operands, which are linked together by operators, can be base terms or can themselves be expressions. Base terms are terms within an expression that are not further divisible, i.e. that do not contain operators.
In the simplest case, an expression consists of a single operand; the value of the expression is then the value of the operand. This type of expression and expressions that consist of a single operator whose operands are base terms are called “simple expressions”, as opposed to complex expressions in which at least one of the operands is an expression. This expression can be either a simple or a complex expression.
The following terms are combined under the generic term “base term”:
numbers
Boolean constants
string literals
variable names
function calls
The operators are divided into four categories:
arithmetic operators
logical operators
relational operators
concatenation operators
The data type of an expression without operators is determined by the data type of the base term. Otherwise, the way in which the operators are combined determines the data type of the expression. There are thus three types of expression:
arithmetic expressions
logical or Boolean expressions
string expressions
This chapter begins by describing the base terms, followed by the operators, expression types and, finally, the rules of syntax, interpretation and evaluation for expressions.