GO基础深入总结

GO的关键字:
包管理:package、import
变量:var、map、struct、interface、const、type
函数:func、return、defer
循环:if、else、switch、case、fallthought、default、for、break、continue、goto、range
并发:go、chan、select

GO的变量类型:
(1)整型
int(默认)、int8、int16、int32、int64、byte
uint、uint8、uint16、uint32、uint64
(2)浮点型:float32、float64(默认)
(3)复数:complex64、complex128(默认)
(4)数组:值拷贝、不同长度和不同类型的数组都是一个新类型
(5)切片:引用
(6)map:引用
(7)复合类型:interface、struct

GO的内置函数:append、cap、new、make、copy、len、delete、panic、recover
(1)append:向切片中添加一个或多个值

// 注意:有个潜在的问题,看下面的代码
package main

import "fmt"

func main() {

猜你喜欢

转载自my.oschina.net/u/3611008/blog/2967369