If the numbers are converted to the string, they usually need to be reasonably formatted. The formatting of a number means the number is printed with a given number, made up of digits and decimals. The representation of a value can also be chosen. A closely related problem with this, however, is the localization of number formatting. For example, some languages use comma-separated zeros.
Formatting numbers
How to do it...
- Open the console and create the folder chapter03/recipe05.
- Navigate to the directory.
- Create the format.go file with the following content:
package main
import (
"fmt"
)
var integer int64 = 32500
var floatNum float64 = 22000.456
func main() ...