N'th: Difference between revisions

446 bytes added ,  1 month ago
no edit summary
mNo edit summary
No edit summary
Line 2,433:
1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th 1011th 1012th 1013th 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st 1022nd 1023rd 1024th 1025th
</pre>
 
=={{header|Fennel}}==
{{trans|Lua}}
 
<syntaxhighlight lang="fennel">
(fn get-suffix [n]
(let [last-two (% n 100)
last-one (% n 10)]
(if (and (> last-two 3) (< last-two 21)) :th
(= last-one 1) :st
(= last-one 2) :nd
(= last-one 3) :rd
:th)))
 
(fn nth [n]
(.. (.. n "'") (get-suffix n)))
 
(for [i 0 25]
(print (nth i) (nth (+ i 250)) (nth (+ i 1000))))
</syntaxhighlight>
 
{{out}}
Same as [[#Lua|Lua]].
 
=={{header|Forth}}==
62

edits