MOD/de
(Difference between revisions)
m (1 revision) |
(→(**COPIED FROM ENGLISH PAGE**) =) |
||
Line 1: | Line 1: | ||
− | + | = <span class="f_Header">Funktion</span> = | |
− | + | Berechnet den Rest einer Division. | |
<span style="font-family: Arial;"> </span> | <span style="font-family: Arial;"> </span> |
Revision as of 01:36, 10 March 2013
Contents |
Funktion
Berechnet den Rest einer Division.
Syntax
var1 = var2 MOD var3
Remarks
var1 |
Variable that will be assigned with the modules of var2 and var3. |
var2 |
A numeric variable to take the modules from |
var3 |
The modulus |
The MOD operation is similar to the division operation(/). But while a division returns the number of times a number can be divided, the MOD returns the remainder.
For example : 21 MOD 3 will result in 0 since 7x3=21. There will be no remainder.
But 22 MOD 3 will result in 1 since 22-(7x3)=1
In BASCOM, the variable you assign determines which kind of math will be used. When you have 2 word variables you want to get the modulus from, you have to assign a word variable too.
When you assign a byte, byte math will be used.
See also
Example
Dim L As Long , L2 As Long For L = 1 To 1000 L2 = L Mod 100 If L2 = 0 Then ' multiple of 100 Print L End If Next
Languages | English • Deutsch |
---|