摘要:
Go 6 自定义类型和类型别名 type Myint int // 自定义类型 type newint = int // 类型别名 类型别名只在代码编写过程中有效,编译完之后就不存在,内置的byte和rune都属于类型别名。 结构体 结构体是一种数据类型,一种可以保存多个维度数据的类型。 type 阅读全文
摘要:
Go 5 递归函数 package main import "fmt" // 递归函数,一定要有一个明确的退出条件 // 计算n的阶乘 func f1(n int) int { if n > 0 { res := n * f1(n-1) return res } else { return 1 } 阅读全文