Integers
Go offers support for four different sizes of signed and unsigned integers, named int8, int16, int32, int64; and uint8, uint16, uint32, and uint64, respectively. The number at the end of each type shows the number of bits used for representing each type.
Additionally, int and uint exist and are the most efficient signed and unsigned integers for your current platform. Therefore, when in doubt, use int and uint, but have in mind that the size of these types changes depending on the architecture.
The difference between signed and unsigned integers is the following: if an integer has eight bits and no sign, then its values can be from binary 00000000 (0) to binary 11111111 (255). If it has a sign, then its values can be from -127 to ...
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