Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Is even or odd?

Posted on 2000-03-03
4
Medium Priority
?
315 Views
Last Modified: 2011-09-20
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.

0
Comment
Question by:blue021097
  • 3
4 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 2581555
Function EvenOrOdd(num)

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

End Function
0
 

Author Comment

by:blue021097
ID: 2581645
(Edited by Computer101), it is not working.
0
 
LVL 32

Expert Comment

by:jhance
ID: 2581673
Well what's it doing?
0
 
LVL 32

Expert Comment

by:jhance
ID: 2581683
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question