FormatNumber

Family: String · 4 forms

What it does

FormatNumber takes number (a float), and answers a string. That is the first of 4 forms.

Syntax

1
FormatNumber(number float) → string
2
FormatNumber(number float, decimals integer) → string
3
FormatNumber(number float, decimals integer, decimalPoint string) → string
4
FormatNumber(number float, decimals integer, decimalPoint string, thousandsSeparator string) → string

Parameters

NameTypeIn forms
numberfloatall
decimalsinteger2, 3, 4
decimalPointstring3, 4
thousandsSeparatorstring4

Every form returns

string

Example · generated

Form 1, the short one

DO  Print(FormatNumber(1.0))  Sync()LOOP

Form 4, with every argument

DO  Print(FormatNumber(1.0, 1, "value", ","))  Sync()LOOP

FormatNumber is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

21 commands in String