Is even or odd?

Does someone have a function in which I can pass an
Integer and it would return True if Even or False if odd?

Please be clear in your answer, I am new to ASP.

blue021097Asked:
Who is Participating?
 
jhanceConnect With a Mentor Commented:
Function EvenOrOdd(num)

 If ((num / 2) * 2) = num Then
   EvenOrOdd = True
 Else
   EvenOrOdd = False
 End If

End Function
0
 
blue021097Author Commented:
(Edited by Computer101), it is not working.
0
 
jhanceCommented:
Well what's it doing?
0
 
jhanceCommented:
OK, I see the problem.  Try it like this:

Function EvenOrOdd(num)

                     If (Int((num / 2)) * 2) = num Then
                       EvenOrOdd = True
                     Else
                       EvenOrOdd = False
                     End If

End Function
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.