N'th: Difference between revisions
Content added Content deleted
Line 752: | Line 752: | ||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
{{trans|C#}} |
{{trans|C#}} |
||
ELENA |
ELENA 5.0 : |
||
<lang elena>import extensions; |
<lang elena>import extensions; |
||
import system'math; |
import system'math; |
||
Line 762: | Line 762: | ||
{ |
{ |
||
int i := self.Absolute; |
int i := self.Absolute; |
||
if (new int[] |
if (new int[]{11,12,13}.ifExists(i.mod:100)) |
||
{ |
{ |
||
^ i. |
^ i.toPrintable() + "th" |
||
}; |
}; |
||
(i.mod |
(i.mod(10)) => |
||
1 { ^ i. |
1 { ^ i.toPrintable() + "st" } |
||
2 { ^ i. |
2 { ^ i.toPrintable() + "nd" } |
||
3 { ^ i. |
3 { ^ i.toPrintable() + "rd" }; |
||
^ i. |
^ i.toPrintable() + "th" |
||
} |
} |
||
} |
} |
||
Line 778: | Line 778: | ||
public program() |
public program() |
||
{ |
{ |
||
console.printLine(new Range(0,26).selectBy(mssgconst ordinalize<op>[ |
console.printLine(new Range(0,26).selectBy(mssgconst ordinalize<op>[1])); |
||
console.printLine(new Range(250,26).selectBy(mssgconst ordinalize<op>[ |
console.printLine(new Range(250,26).selectBy(mssgconst ordinalize<op>[1])); |
||
console.printLine(new Range(1000,26).selectBy(mssgconst ordinalize<op>[ |
console.printLine(new Range(1000,26).selectBy(mssgconst ordinalize<op>[1])) |
||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |