ID:142762
 
Code:
stat("It is [day], the [cardinal(date)] of [month]")

proc
cardinal(n as num)
switch(n)
if(1||21||31)
return "[n]st"
else if(2||22)
return "[n]nd"
else if(3||23)
return "[n]rd"
else
return "[n]th"


Problem description: It is the 10nd of January. It is the 1st of January. It is the 2st of January. Thanks.

The switch() statement has a special syntax. What you'd want to use here is a if(1,21,31), if(2,22), etc.

However there are two better ways to do this. If you're sending output to a browse() result, which can't use most text macros, I'd use this:

proc/cardinal(n)
if(round(n/10) % 10 == 1) return "th"
switch(n % 10)
if(1) return "st"
if(2) return "nd"
if(3) return "rd"
return "th"


In a stat() command or any regular output, just use the \th macro:

stat("It is [day], the [date]\th of [month]")


Lummox JR