Can someone explain and give some example of what mod is good for?

I haven't used it or got the hang of how it works, and the qb help file don't make much sense to me..

MOD simply returns the remainder after division. integer division "\" and MOD allow integers to be divided without resorting to floating point numbers. The integer division functions are much faster than the floating point math functions. MOD can be used for all sorts of little tricks.

The following code demonstrates integer division, MOD, and "regular" division. Use just one of the IF statements...the output is the same no matter which one you choose. The logic basically says that if the result of the division has no remainder, then a factor has been found and therefore the prime candidate is not prime.

DEFINT A-Z

PRINT "This program prints odd primes less than 100"

FOR IsaPrime = 3 TO 100 STEP 2

FOR TestIt = 3 TO SQR(IsaPrime) STEP 2

'IF (INT(IsaPrime / TestIt)) = (IsaPrime / TestIt) THEN GOTO NotPrime

'IF (IsaPrime MOD TestIt) = 0 THEN GOTO NotPrime

IF IsaPrime MOD TestIt THEN ELSE GOTO NotPrime

'IF IsaPrime / TestIt = IsaPrime \ TestIt THEN GOTO NotPrime

NEXT TestIt

PRINT IsaPrime;

NotPrime:

NEXT IsaPrime

PRINT

END

Here's another example...simply tests if a number is odd or even

INPUT "give me a number"; x

IF x MOD 2 THEN PRINT "odd" ELSE PRINT "even"