Even and Odd number
This is my first snipet and it is not fancy at all but it can be useful in some case.
It check if the integer is a Even or a Odd number: PHP Code:
PHP Code:
|
Re: Even and Odd number
PHP Code:
|
Re: Even and Odd number
Thanks, nice optimization. UPDATED.
|
Re: Even and Odd number
Code:
stock bool:IsEven(num) |
Re: Even and Odd number
Thanks again, UPDATED.
|
Re: Even and Odd number
return return ?
Quote:
|
Re: Even and Odd number
You can probably just leave off the equality.
Code:
stock bool:IsOdd(num) |
Re: Even and Odd number
Sorry to bump but does it consider 0 as even?
|
Re: Even and Odd number
Quote:
|
Re: Even and Odd number
Quote:
|
All times are GMT -4. The time now is 09:43. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.