Spelling of ordinal numbers: Difference between revisions
Content deleted Content added
updated as per talk page |
Added Quackery. |
||
Line 1,736:
1.23e2 => one hundred and twenty-third
</pre>
=={{header|Quackery}}==
<code>name$</code> is defined at [[Number names#Quackery]].
<code>switch</code>, <code>case</code>, and <code>otherwise</code> are defined at [[Metaprogramming#Quackery]].
<syntaxhighlight lang="Quackery"> [ name$
dup -2 split nip
[ switch
$ "ne" case
[ -3 split drop
$ "first" join ]
$ "wo" case
[ -3 split drop
$ "second" join ]
$ "ee" case
[ -3 split drop
$ "ird" join ]
$ "ve" case
[ -2 split drop
$ "fth" join ]
$ "ht" case
[ $ "h" join ]
$ "ty" case
[ -1 split drop
$ "ieth" join ]
otherwise
[ $ "th" join ] ] ] is nameth$ ( n --> $ )
' [ 1 2 3 4 5 11 65 100 101 272 23456 8007006005004003 ]
witheach
[ dup echo say " = " nameth$ echo$ cr ]</syntaxhighlight>
{{out}}
<pre>1 = first
2 = second
3 = third
4 = fourth
5 = fifth
11 = eleventh
65 = sixty fifth
100 = one hundredth
101 = one hundred and first
272 = two hundred and seventy second
23456 = twenty three thousand and four hundred and fifty sixth
8007006005004003 = eight quadrillion, seven trillion, six billion, five million, four thousand and third</pre>
=={{header|Raku}}==
|