Results 1 to 2 of 2

Thread: Even/odd function here

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    421

    Even/odd function here

    VB Code:
    1. Private Function IsEven(lNum As Long) As Boolean
    2.     IsEven = Not CBool(lNum& And 1)
    3. End Function
    Useful little function in case anyone was wondering on how to determine if a number is even or odd. I must be bored...
    [vbcode]
    ' comment
    Rem remark
    [/vbcode]

  2. #2
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    Another way
    Code:
    If Number mod 2 = 0 then 'number is even Else 'number is odd

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width