RosettaCodeData/Task/Nth/Picat/nth-1.picat
2023-07-01 13:44:08 -04:00

7 lines
225 B
Text

nth2(N) = N.to_string() ++ Th =>
( tween(N) -> Th = "th"
; 1 = N mod 10 -> Th = "st"
; 2 = N mod 10 -> Th = "nd"
; 3 = N mod 10 -> Th = "rd"
; Th = "th" ).
tween(N) => Tween = N mod 100, between(11, 13, Tween).