Operators are simple ways to process values and are usually represented by one or two special characters in your source code
The assignment (equals, =) and addition (+) operators are the only ones which can be used with strings. All operators work with numeric values.
Most operators can work in a shortcut mode, taking the form <variable> <operator> <expression>. This is the same as writing <variable> = <variable> <operator> <expression> in your code.
When using the shortcut mode the result of the calculation must not be used otherwise the variable will not be modified.
Expression is the general name for a calculation and can be as simple as a fixed value or as complex as a formula using many operators and any item which can represent a value (including, for example, the value returned by a command - you use the command directly in the expression)
Brackets can be used to change the order of evaluation of expressions, which would usually follow the order of multiplication or division followed by addition or subtraction. Operators of the same precedence are evaluated in the order they are written in your source (from left to right).
| Previous topic | Chapter contents | Next topic |
|---|---|---|
| Expressions | User Guide contents | Practise exercises |