Feven()/Fodd()
Checks if a floating value is even or odd.
Feven() checks if even
Fodd() checks if odd.
Syntax: byte = Feven( a as single )
Syntax: byte = Fodd( a as single )
Return values
- 0 = False
- 1 = True
- 2 = Neither
The function requires whole numbers. The whole part of the number is converted to an integer, therefore the decimal part is not taken into account. The function returns „neither even nor odd“ if the decimal part is not zero.
Example:
dim a as single a=28.22 select case Fodd(a) case 0 print "The number ";str(a);" is even." case 1 print "The number ";str(a);" is odd." case 2 print "The number ";str(a);" ist neither even nor odd" end select select case Feven(a) case 0 print "The number ";str(a);" is odd." case 1 print "The number ";str(a);" is even." case 2 print "The number ";str(a);" ist neither even nor odd" end select