Even or odd: Difference between revisions
Content added Content deleted
(→dc: add) |
|||
Line 3,710: | Line 3,710: | ||
next |
next |
||
</syntaxhighlight> |
</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}}== |
=={{header|Ruby}}== |