N'th: Difference between revisions
Content added Content deleted
(→{{header|MiniScript}}: Fixed 1011, 1012 and 1013, show each range as a separate line) |
(→{{header|Red}}: Fixed 1011, 1012 and 1013) |
||
Line 3,694: | Line 3,694: | ||
nth: function [n][ |
nth: function [n][ |
||
d: n % 10 |
d: n % 10 |
||
dd: n % 100 |
|||
suffix: either any [d < 1 d > 4 1 = to-integer n / 10] [4] [d] |
suffix: either any [ all [ dd > 3 dd < 20 ] d < 1 d > 4 1 = to-integer n / 10] [4] [d] |
||
rejoin [n pick ["st" "nd" "rd" "th"] suffix] |
rejoin [n pick ["st" "nd" "rd" "th"] suffix] |
||
] |
] |
||
Line 3,712: | Line 3,713: | ||
0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th |
0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th |
||
250th 251st 252nd 253rd 254th 255th 256th 257th 258th 259th 260th 261st 262nd 263rd 264th 265th |
250th 251st 252nd 253rd 254th 255th 256th 257th 258th 259th 260th 261st 262nd 263rd 264th 265th |
||
1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th |
1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th 1011th 1012th 1013th 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st |
||
</pre> |
</pre> |
||