Even or odd: Difference between revisions
→{{header|RPL}}
(→dc: add) |
|||
Line 3,710:
next
</syntaxhighlight>
=={{header|RPL}}==
To test oddity of real numbers (floating point numbers) :
≪ 2 MOD ≫ ‘ODD?’ STO
To test oddity of binary integers (unsigned integers) :
≪ #1 AND #1 ≠ ≫ ‘BODD?’ STO
To test oddity without caring of the data type :
≪ IF DUP TYPE THEN #1 AND #1 ≠ ELSE 2 MOD END ≫
=={{header|Ruby}}==
|