Golang之零值
false : bool;
0: integer;
0.0: float;
?"": string;
nil : pointer, function, interface, slice, channel, map 。
對(duì)于復(fù)合類型, go語(yǔ)言會(huì)自動(dòng)遞歸地將其內(nèi)每一個(gè)元素初始化為其類型對(duì)應(yīng)的零值。比如:數(shù)組, 結(jié)構(gòu)體 。 (對(duì)于復(fù)合類型,是否能比較也是遞歸的看其內(nèi)的每一個(gè)元素能否比較)。
總結(jié)
- 上一篇: Golang之gjson
- 下一篇: k8s之CRD定义map[string]