%
| Syntax |
expression1 % expression2
|
| Action |
The arithmetic modulus operator yields the remainder when dividing the value of expression1 by the value of expression2.
|
| Examples |
10 % 4 » 2
Four goes two times into 10, leaving a remainder of two.
This statement generates an error; the modulus operator does not work on floating point values, since the result of floating point division is not truncated and thus has no remainder.
This expression yields the number of seconds into the current hour we are right now. |
| Notes |
Only integral-compatible types - short, long, date, etc. - can be used in the modulus operation. UserTalk employs automatic type coercion when evaluating arithmetic and comparative operations; the two expressions of the modulus operation need not be of the same type. Generally, the resulting type is the more complex type, the one that can most readily represent both values.
|
| See Also |
+
|