format_number

Writes a number as text with a fixed number of decimal places and a thousands separator: format_number(1234.5, 2) is "1,234.50". The separators can be changed; halves round away from zero.

Runs on: either side: the compiler places the statement that calls it where the values it uses live.

Format:

format_number(number [, places] [, thousands_separator] [, decimal_point])

Parameters:

Parameter Type Description
number number the number
places number  [Optional]the decimal places; 0 unless given
thousands_separator string  [Optional]the text between groups of three digits; a comma unless given
decimal_point string  [Optional]the text before the decimals; a point unless given

Returned Value:

Type Description
string the formatted number

Examples

price_text = concat("$", format_number(price, 2))