Mod: Difference between revisions
Jump to navigation
Jump to search
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.'' | |||
''result'' = ''x'' Mod ''y'' | ''result'' = ''x'' Mod ''y'' | ||
Line 5: | Line 7: | ||
Mod divides ''x'' by ''y'' and returns the integer part of the remainder. The required parameters, ''x'' and ''y'', are any valid numeric expressions. The value of ''result'' is a whole number with a magnitude less than the magnitude of ''y''. | Mod divides ''x'' by ''y'' and returns the integer part of the remainder. The required parameters, ''x'' and ''y'', are any valid numeric expressions. The value of ''result'' is a whole number with a magnitude less than the magnitude of ''y''. | ||
== Example == | == Example (Basic) == | ||
<pre> | <pre> | ||
Line 21: | Line 23: | ||
<pre> | <pre> | ||
15 Mod 2 = 1 | 15 Mod 2 = 1 | ||
21 Mod 3.7 = | 21 Mod 3.7 = 2.5 | ||
</pre> | </pre> | ||
Line 27: | Line 29: | ||
[[Category:Math]] | [[Category:Math]] | ||
[[Category:BASIC Functions]] |
Latest revision as of 15:31, 25 March 2019
This function is for BASIC compatibility. It is not available in pure JavaScript projects.
result = x Mod y
Description
Mod divides x by y and returns the integer part of the remainder. The required parameters, x and y, are any valid numeric expressions. The value of result is a whole number with a magnitude less than the magnitude of y.
Example (Basic)
Rem Mod Example 'Mod returns quotient remainder as integer Dim Answer Answer = 15 Mod 2 Print "15 Mod 2 = " & Answer Answer = 21 Mod 3.7 Print "21 Mod 3.7 = " & Answer
Output
15 Mod 2 = 1 21 Mod 3.7 = 2.5