What it does
FormatNumber takes number (a float), and answers a string. That is the first of 4 forms.
Syntax
1
FormatNumber(number float) → string2
FormatNumber(number float, decimals integer) → string3
FormatNumber(number float, decimals integer, decimalPoint string) → string4
FormatNumber(number float, decimals integer, decimalPoint string, thousandsSeparator string) → stringParameters
| Name | Type | In forms |
|---|---|---|
| number | float | all |
| decimals | integer | 2, 3, 4 |
| decimalPoint | string | 3, 4 |
| thousandsSeparator | string | 4 |
Every form returns
string
Example · generated
Form 1, the short one
DO Print(FormatNumber(1.0)) Sync()LOOPForm 4, with every argument
DO Print(FormatNumber(1.0, 1, "value", ",")) Sync()LOOPFormatNumber 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.