原文链接: http://simon-c.iteye.com/blog/1016031 引用 For type byte, the default value is zero, that is, the value of (byte)0. For type short, the default value is zero, that is, the value of (short)0. For type int, the default value is zero, that is, 0. Fo…
默认值: 整型的默认值:0 浮点型的默认值:0字符串的默认值:"" //空布尔类型的默认值:false package mainimport "fmt" func main() { var a int //0 var b float32 //%f的输出是0.000000,%v的输出是0 var c float64 //%f的输出是0.000000,%v的输出是0 var isMarryied bool //false var name string //&quo…
代码 // 基本数据类型(整型,浮点型,字符串型,布尔型)的默认值 package main import ( "fmt" ) func main() { var a int var b float32 var c bool var d string fmt.Printf("整型a的值为%v, 浮点型b的值为%v, 布尔型c的值为%v, 字符串型d的值为%v\n", a, b, c, d) // 整型a的值为0, 浮点型b的值为0, 布尔型c的值为false, 字符…