Integers, uints, floats, and complex numbers all have type sizes.
int int8 int16 int32 int64
uint uint8 uint16 uint32 uint64 uintptr
float32 float64
complex64 complex128
The size (8, 16, 32, 64, 128, etc.) represents how many bits in memory will be used to store the variable. The "default" int and uint types refer to their respective 32 or 64-bit sizes depending on the environment of the user.
The "standard" sizes that should be used unless you have a specific performance need (e.g. using less memory) are:
intuintfloat64complex128Some types can be easily converted like this:
temperatureFloat := 88.26
temperatureInt := int64(temperatureFloat)
Casting a float to an integer in this way truncates the floating point portion.
Our Textio customers want to know how long they have had accounts with us.
On line 7, create an accountAgeInt variable and assign it the value of accountAgeFloat truncated to an integer.