3.6. Operators and Expressions

Gamma provides operators for the basic arithmetic calculations: addition, subtraction, multiplication, division and taking the modulus. There is also a group of assignment, bitwise, comparison, increment and decrement, logical, and quote operators. For information on operator precedence and associativity see Operators in the Reference Manual.

Operators are used with one, two, or three values to create expressions. For instance, 4 + 2 is an expression whose value is 6. In Gamma, every expression has a value.

Not all expressions contain operators, though. The number 5, for example, is also an expression. Generally speaking, an expression in Gamma is anything that can be evaluated. This includes numbers, symbols that have been assigned values, strings, t, nil, constants, lists, arrays, and so on.

These are also known as symbolic expressions, a term that has been abbreviated to s_exp. Since expressions are often used as arguments for functions, you will come across the parameter s_exp in function definitions in the Reference Manual.

An expression can become a statement by adding a semicolon. Thus, 4 + 2; is a statement. For more information on statements, see the Statements section in the Control Flow chapter.