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 ...
Get Learning Go Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.