N'th: Difference between revisions

936 bytes added ,  4 years ago
added MiniScript example
(added MiniScript example)
Line 1,718:
EndSub
</lang>
 
=={{header|MiniScript}}==
To get the output all on one line, we append it to a list as we go, and then print the list all at once at the end.
 
<lang MiniScript>ordinal = function(n)
if n % 10 == 1 then return n + "st"
if n % 10 == 2 then return n + "nd"
if n % 10 == 3 then return n + "rd"
return n + "th"
end function
 
out = []
test = function(from, to)
for i in range(from, to)
out.push ordinal(i)
end for
end function
 
test 0, 25
test 250, 265
test 1000, 1025
print out.join</lang>
 
{{out}}
<pre>0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11st 12nd 13rd 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 1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th 1011st 1012nd 1013rd 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st 1022nd 1023rd 1024th 1025th</pre>
 
=={{header|Modula-2}}==
222

edits