Go语言学习笔记 - 第二章 程序结构(The Go Programming Language)
第二章 程序结构 2.1命名 划重点 函数名、变量名、常量名、类型名、语句标号和包名 以一个字母(Unicode字母)或下划线开头,跟任意数量的字母、数字或下划线,大写字母和小写字母是不同的。 关键字(25个) break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var 预定义的名字 (30+个),这些不是关键字,可以再定义中重新使用它们 内建常量: true false iota nil 内建类型: int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 uintptr float32 float64 complex128 complex64 bool byte rune string error 内建函数: make len cap new append copy close delete complex real imag panic recover 作用域:内部定义内部有效;外部定义包内有效,名字开头 大写 可在包外部可见。比如: fmt 的 Print 可以在 fmt