I don't understand "MOD" function.

BlitzMax Forums/BlitzMax Beginners Area/I don't understand "MOD" function.

MOD returns the remainder after a division.

So for example 2 goes into 10 5 times with a remainder of 0... 10 MOD 2 equals 0

2 goes into 11 5 times with a remainder of 1... 11 MOD 2 equals 1

[EDIT]
Some realworld examples,

Say for example you had a variable representing seconds, then MOD 60 would remove the whole minutes and return the remaining seconds...

182 MOD 60 would return 2 ( removing 3 minutes '3*60')

Say for example you had a variable representing an angle,

;increment the angle
angle=(angle+1) MOD 360

then MOD 360 would remove any 360 degree rotation and make the value appear to wrap around e.g. 358,359,0,1,2,3

Without MOD the above would be
angle=angle+1:If angle>360 Then angle=angle-360