N'th: Difference between revisions

1,229 bytes added ,  3 years ago
Added 11l
m (added whitespace and a section header.)
(Added 11l)
Line 16:
'''Note:''' apostrophes are now ''optional'' to allow correct apostrophe-less English.
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>V _suffix = [‘th’, ‘st’, ‘nd’, ‘rd’, ‘th’, ‘th’, ‘th’, ‘th’, ‘th’, ‘th’]
 
F nth(n)
R ‘#.'#.’.format(n, I n % 100 <= 10 | n % 100 > 20 {:_suffix[n % 10]} E ‘th’)
 
L(j) (0..1000).step(250)
print_elements(Array(j.+25).map(i -> nth(i)))</lang>
 
{{out}}
<pre>
0'th 1'st 2'nd 3'rd 4'th 5'th 6'th 7'th 8'th 9'th 10'th 11'th 12'th 13'th 14'th 15'th 16'th 17'th 18'th 19'th 20'th 21'st 22'nd 23'rd 24'th
250'th 251'st 252'nd 253'rd 254'th 255'th 256'th 257'th 258'th 259'th 260'th 261'st 262'nd 263'rd 264'th 265'th 266'th 267'th 268'th 269'th 270'th 271'st 272'nd 273'rd 274'th
500'th 501'st 502'nd 503'rd 504'th 505'th 506'th 507'th 508'th 509'th 510'th 511'th 512'th 513'th 514'th 515'th 516'th 517'th 518'th 519'th 520'th 521'st 522'nd 523'rd 524'th
750'th 751'st 752'nd 753'rd 754'th 755'th 756'th 757'th 758'th 759'th 760'th 761'st 762'nd 763'rd 764'th 765'th 766'th 767'th 768'th 769'th 770'th 771'st 772'nd 773'rd 774'th
1000'th 1001'st 1002'nd 1003'rd 1004'th 1005'th 1006'th 1007'th 1008'th 1009'th 1010'th 1011'th 1012'th 1013'th 1014'th 1015'th 1016'th 1017'th 1018'th 1019'th 1020'th 1021'st 1022'nd 1023'rd 1024'th
</pre>
 
=={{header|8080 Assembly}}==
1,481

edits