|
| |
Expressions
Definitions:
- operators can be: + - * / %
and = ;
- terms are either: variables
(or objects), constants or a function calls;
Rules:
- Terms must be separated by an operator.
- The two terms will be operated according to the rule
prescribed for that operator.
- A term may be preceded by the operators "+" or "-" .
- Operators have different
priorities
- A variable (or object) can be used in the left side of an
assignment operator (=).
- The result of the expression is assigned to the variable
whose identifier is at the left side of the " = ".
- More than one assignment operator can be used in an
expression, provided each one is preceded by only on
variable.
Examples:
- Illegal expressions:
- 3 times howmany times
- Legal expressions:
- howmany * times 3 * times
|