int16 is a 16-bit signed integer with a range from -32,768 to 32,767. If you try to add 1 to 32,767 (the maximum value for int16), it will overflow, wrapping around to the minimum value, -32,768, due to how binary arithmetic works in fixed-size integers. This is called integer overflow.
var x int16 = 32767
x = x + 1 // x becomes -32768
int32: A 32-bit signed integer with a range from -2,147,483,648 to 2,147,483,647.int64: A 64-bit signed integer with a range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.uint16: A 16-bit unsigned integer with a range from 0 to 65,535.float32: A 32-bit floating-point number with a range of approximately ±1.18e-38 to ±3.4e38 and a precision of about 6-7 decimal digits.You can initialize two variables in the same line with the following:
var1, var2 := 1, 2
:= is Go's short variable declaration operator. It declares a new variable and initializes it in one step.
age := 21 // int
price := 19.99 // float64
isAdmin := false // bool
You can also declare multiple variables:
name, age := "Hamada", 21
// Equivalent to:
var name string = "Hamada"
var age int = 21
You cannot use := again unless at least one variable on the left side is new.
Take note its not allowed at package level.