N'th: Difference between revisions

Content added Content deleted
Line 752: Line 752:
=={{header|Elena}}==
=={{header|Elena}}==
{{trans|C#}}
{{trans|C#}}
ELENA 4.1 :
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[]::(11,12,13).ifExists(i.mod:100))
if (new int[]{11,12,13}.ifExists(i.mod:100))
{
{
^ i.Printable + "th"
^ i.toPrintable() + "th"
};
};
(i.mod:10) =>
(i.mod(10)) =>
1 { ^ i.Printable + "st" }
1 { ^ i.toPrintable() + "st" }
2 { ^ i.Printable + "nd" }
2 { ^ i.toPrintable() + "nd" }
3 { ^ i.Printable + "rd" };
3 { ^ i.toPrintable() + "rd" };
^ i.Printable + "th"
^ i.toPrintable() + "th"
}
}
}
}
Line 778: Line 778:
public program()
public program()
{
{
console.printLine(new Range(0,26).selectBy(mssgconst ordinalize<op>[0]));
console.printLine(new Range(0,26).selectBy(mssgconst ordinalize<op>[1]));
console.printLine(new Range(250,26).selectBy(mssgconst ordinalize<op>[0]));
console.printLine(new Range(250,26).selectBy(mssgconst ordinalize<op>[1]));
console.printLine(new Range(1000,26).selectBy(mssgconst ordinalize<op>[0]))
console.printLine(new Range(1000,26).selectBy(mssgconst ordinalize<op>[1]))
}</lang>
}</lang>
{{out}}
{{out}}