|| Remainder of
||Increase variable by 1|
||Decrease variable by 1|
|| Negate the value of
Most of these are extremely straightforward and don't even deserve discussion. A couple of them need some clariﬁcation, though.
This calculates the remainder of the division of its two parameters. Oric BASIC doesn't have it, but Pascal users will be familiar with it, as the
These two are two very useful operators. Given a variable, they increment or decrement its contents by
-- operator can be put before or after a variable. It behaves diﬀerently, depending on its position. When put before a variable, it changes the variable's value before that variable is used in the expression. If put after a variable, it alters its value after the variable has been used in the expression. This sounds obscure, and requires an example (or two):
Assume we have two variables,
y=20. We calculate the expression
x=x+(++y). The contents of
y are incremented before the variable is used, so the result will be
x=31. The value of
Now let's again assume
y=20. In calculating
x=x+(y++), the contents of
y are used before it gets incremented. Thus,
x=30. The value of
y at the end of the calculation is again
21, but the result of the expression is not the same. This double syntax comes very handy when programming loops.
This is no other than our very own
- operator, as used on single operands. For example, assuming
x=10, the result of
-10. This should be simple enough.