Integers are used to store natural numbers are 1,2,3.
Go has 8 types on integers
int64, and corresponding unsigned versions
unsigned integers can store positive numbers only.
8,16,32 and 64 represents how many bits are used to store value.
–128 to 127
0 to 255
–32,768 to 32,767
0 to 65535
–2,147,483,648 to 2,147,483,647
0 to 4,294,967,295
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
0 to 18,446,744,073,709,551,615
Integers are declared using one of the 3 ways:
main.govar j int32 = 20var i int = 10var i = 10i := 10var k int
If we are not specifying type like in 2nd and 3rd declaration, it will default to
Zero value for integer is
Learn how to do test driven development when using integers from Chris