Odd and Even functions missing in RB 
Author Message
 Odd and Even functions missing in RB

Why exists not a odd/even for integers (result is boolean) function in
RB? I think its a hard thing. This are basically functions - must build
in.

F.E.

(Yes i can buld myself with \ oder div, but its very unuseable and slow)



Tue, 01 Jul 2003 22:29:57 GMT  
 Odd and Even functions missing in RB

Quote:

>Why exists not a odd/even for integers (result is boolean) function in
>RB? I think its a hard thing. This are basically functions - must build
>in.

Use MOD to determine if a number is odd or even:

Function Odd(n As Integer) As Boolean
  Return ((n Mod 2)=1)
End

And for even: If Not Odd(n) Then ... End

Jeff



Wed, 02 Jul 2003 00:24:47 GMT  
 Odd and Even functions missing in RB

Quote:

> Why exists not a odd/even for integers (result is boolean) function in RB?
> I think its a hard thing. This are basically functions - must build in.
> F.E.
> (Yes i can buld myself with \ oder div, but its very unuseable and slow)

IsOdd = (MyInt mod 2 = 1)

not very slow.

--
Email Cleaner does convenient re-wrapping on badly wrapped emails and
newsgroup-posts. Badly wrapped lines is a problem every Internet User
comes across, Email Cleaner solves it! It also has many other features.

Email Cleaner works from inside all of your Mac programs, from one
button click.

<http://www.thsmith.dircon.co.uk/emailcleaner/>



Wed, 02 Jul 2003 06:38:26 GMT  
 Odd and Even functions missing in RB

Quote:


>> Why exists not a odd/even for integers (result is boolean) function in
>> RB? I think its a hard thing. This are basically functions - must build
>> in.
>> F.E.
>> (Yes i can buld myself with \ oder div, but its very unuseable and slow)
> IsOdd = (MyInt mod 2 = 1)
> not very slow.

You can also do it with the bitwiseand operator.

--
Email Cleaner does convenient re-wrapping on badly wrapped emails and
newsgroup-posts. Badly wrapped lines is a problem every Internet User
comes across, Email Cleaner solves it! It also has many other features.

Email Cleaner works from inside all of your Mac programs, from one
button click.

<http://www.thsmith.dircon.co.uk/emailcleaner/>



Wed, 02 Jul 2003 06:53:14 GMT  
 Odd and Even functions missing in RB
Yes, I know, I can made some different workarounds - but I think, this
should be directly implemented in RB.

F.E.



Wed, 02 Jul 2003 20:20:12 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. odd or even function?

2. J: Even and Odd

3. Odd and Even conjunctions

4. Even/odd week number

5. Printing Odd or Even page only

6. Odd or Even

7. determine whether a number is odd or even

8. Even/Odd rounding

9. Even/Odd rounding

10. odd /even addressing?

11. even vs. odd numbers

12. number representations (was: even vs. odd numbers)

 

 
Powered by phpBB® Forum Software