Comment on page
Using Natural Numbers
- 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.
Integers are declared using one of the 3 ways:
var j int32 = 20
var i int = 10
var i = 10
i := 10
var k int
If we are not specifying type like in 2nd and 3rd declaration, it will default to
Zero value for integer is
Always use short declaration way when assigning initial value. If you wish to initialize a variable to its zero value, use var declaration.
Learn how to do test driven development when using integers from Chris