declaration:
var variableName type -->default value 0
var variable1,variable2,variable3 type
declare and initialize:
var variableName type= value
var variable1,variable2,variable3 type = value1, value2, value3
(or)(shorthand)
variableName := value
variable1,variable2,variable3 := value1, value2, value3
---------
const pi float64 = 3.14
var x bool = true
direct initialize:
//go will figure out type
x,y,z:=0,1,2
z1=4+8i
fmt.Println("x: %d\ty: %d\tz: %d\n",x,y,z)
No comments:
Post a Comment