June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
29
Task/Nth/Elena/nth.elena
Normal file
29
Task/Nth/Elena/nth.elena
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import extensions.
|
||||
import system'math.
|
||||
import system'routines.
|
||||
|
||||
extension op
|
||||
{
|
||||
ordinalize
|
||||
[
|
||||
int i := self absolute.
|
||||
if ((11,12,13) ifExists(i mod:100))
|
||||
[
|
||||
^ i literal + "th".
|
||||
].
|
||||
|
||||
(i mod:10) =>
|
||||
1 [ ^ i literal + "st" ];
|
||||
2 [ ^ i literal + "nd" ];
|
||||
3 [ ^ i literal + "rd" ].
|
||||
|
||||
^ i literal + "th".
|
||||
]
|
||||
}
|
||||
|
||||
program =
|
||||
[
|
||||
console printLine(Range new(0,26); selectBy:%"op.ordinalize").
|
||||
console printLine(Range new(250,26); selectBy:%"op.ordinalize").
|
||||
console printLine(Range new(1000,26); selectBy:%"op.ordinalize").
|
||||
].
|
||||
Loading…
Add table
Add a link
Reference in a new issue