They are the integer division operator (\) and the modulus division operator (mod)
Examples of usage:
- Code: Select all
a=7\2
b=7mod2
Msgbox a
Msgbox b
Now "a" is going to store the value "3", because the integer deriving from the 7/2 division is 3 and "b" is going to store the value "1", because the modulus of 7/2 is 1
It all comes from euclidean division, Euclides mathematical model of division:
a=b*a\b+amodb
The practical uses of these operators are many in programming. One common use is this:
- Code: Select all
If amod2=0 then
msgbox "a is not a prime number"
else if amod2=1 then
msgbox "a is a prime number"
end if
end if