Divides the value of one expression by the value of another, and returns the remainder.
Arguments
- number1
-
Any numeric expression.
- number2
-
Any numeric expression.
Remarks
Example
The following example illustrates a use of the modulus operator.
В | Copy Code |
---|
var myMoney : int = 128;
var cookiePrice : int = 33;
// Calculate the change if the maximum number of cookies are bought.
var change : int = myMoney % cookiePrice;
// Calculate number of cookies bought.
var numCookies : int = Math.round((myMoney-change)/cookiePrice); |
Requirements
See Also