This now works. I need to play a bit more with it.
Code:
program:
days = 2112;
years = floor(days/360);
months = floor(mod(days, 360)/30);
days = days - ((years*360) + (months * 30));
def to_plural(v, str):
if v == 0 then return '' fi;
return v & ' ' & (if v == 1 then str else str & 's' fi) & ' '
fed;
to_plural(years, 'year') & to_plural(months, 'month') & to_plural(days,'day')
The '&' operator (strcat) is there and used in the above template.
I decided to use the same syntax to define functions as used everywhere else, defining the function body with def/fed instead of {}. This is like if/fi and for/rof. As well as being consistent it avoids some problems with matching blocks and also makes using semicolons more consistent.