fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 23: Convert real number to string with 2 decimal places
Idiom # 23: Convert real number to string with 2 decimal places
See
programming-idioms.org
:
Code
Code input
# Convert to String with exactly 2 decimal places s := x.as_string_decimals 2
What are effects?
Runnable Example
Code input
x := 3.14563 say (x.as_string_decimals 2) # Output: 3.15
What are effects?
last changed: 2026-06-12
next: Idiom # 24: Assign to string the japanese word ネコ