Expressions in most languages are written in infix form, with the operator between the operands.

Prefix or ``Cambridge Polish'': (+ A B)
Infix: A + B
Postfix, Reverse Polish or RPN: AB+

The precedence of operators determines which operator is performed first in a flat expression: a + b * c is interpreted as (+ a (* b c)) because * has higher precedence than +.

Assignment (corresponding to set! in Scheme) is done using the operator := or = .

Scheme: (set! x (+ a (* b c))))
Pascal: x := a + b * c
C++, Java: x = a + b * c;

C++ and Java provide the unary operators ++ and --, which add or subtract 1 from their argument and return its value. These may be placed before or after the argument.

   j = i++;
will give j the existing value of i, then add 1 to i.

Contents    Page-10    Prev    Next    Page+10    Index