RosettaCodeData/Task/Nth/Sidef/nth.sidef

9 lines
253 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
func nth(n) {
2017-09-23 10:01:46 +02:00
static irregulars = Hash(<1 ˢᵗ 2 ⁿᵈ 3 ʳᵈ 11 ᵗʰ 12 ᵗʰ 13 ᵗʰ>...)
n.to_s + (irregulars{n % 100} \\ irregulars{n % 10} \\ 'ᵗʰ')
2016-12-05 23:44:36 +01:00
}
2017-09-23 10:01:46 +02:00
for r in [0..25, 250..265, 1000..1025] {
say r.map {|n| nth(n) }.join(" ")
2016-12-05 23:44:36 +01:00
}