The VBScript Mod operator divides two numbers and returns the remainder. So in our code the parameter 'iNumber' passed into our subroutine OddEvenNumber is divided by 2. If the remainder is 0 then the number is even.
If iNumber MOD 2 = 0 Then
Response.write "The number " & iNumber & " is EVEN<br />"
Response.write "The number " & iNumber & " is ODD<br />"
'Call our sub and pass in the number 4 as a parameter
'Call our sub and pass in the number 13 as a parameter
The result of our code above is:
The number 4 is EVEN
The number 13 is ODD