Numeric types
Go's numeric types include support for integral and decimal values with a variety of sizes ranging from 8 to 64 bits. Each numeric type has its own layout in memory and is considered unique by the type system. As a way of enforcing this, and to avoid any sort of confusion when porting Go on different platforms, the name of a numeric type reflects its size requirement. For instance, type
int16
indicates an integer type that uses 16 bits for internal storage. This means that numberic values must be explicitly be converted when crossing type boundaries in assignments, expressions, and operations.
The following program is not all that functional, since all values are assigned to the blank identifier. However, it illustrates all of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access