2022-4-12 实习Day12
1、tf-exi开发包结构注释规范标记检验,格式优化–3小时 100%
2、数据库全量升级 –1小时 100%
3、客户管理模块测试,发现表格导出错误。–2小时 100%
4、机构、客户测试数据配置 –2小时 50%
Golang编程学习(part 7)
1、程序流程控制
① 顺序控制:程序从上到下逐行执行,中间没有任何判断和跳转。
② 分支控制:单分支、双分支、多分支
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| if `条件` { }
if `条件` { } else { }
if `条件1` { } else if `条件2` { }…… else { }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
switch `表达式` { case `表达式1`,`表达式2`,...: 语句块1 case `表达式3`,`表达式4`,...: 语句块2 default: 语句块3 }
var age int = 10 switch{ case age==10: fmt.Println("age==10") case age==20: fmt.Println("age==10") default: fmt.Println("没有匹配到") }
|
1 2 3 4 5 6 7 8 9 10 11 12 13
|
var score int = 90 switch{ case score > 90: fmt.Println("成绩优秀..") case score >= 70 && score <= 90: fmt.Println("成绩优良..") case score >= 60 && score < 70: fmt.Println("成绩及格..") default: fmt.Println("不及格") }
|
1 2 3 4 5 6 7 8 9 10 11
| switch grade:=90; { case grade > 90: fmt.Println("成绩优秀~..") case grade >= 70 && grade <= 90: fmt.Println("成绩优良~..") case grade >= 60 && grade < 70: fmt.Println("成绩及格~..") default: fmt.Println("不及格~") }
|
1 2 3 4 5 6 7 8 9 10 11 12 13
| var num int = 10 switch num { case 10: fmt.Println("成绩优秀~..") fallthrough case 20: fmt.Println("成绩优良~..") case 30: fmt.Println("成绩及格~..") default: fmt.Println("不及格~") }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| var x interface{} var y = 10.0 x=y switch i:=x.(type) { case nil: fmt.Printf("x的类型~ %T",i) case int: fmt.Printf("x是int型") case float64: fmt.Printf("x是float64型") case func(int) float64: fmt.Printf("x是func(int)型") case bool, string: fmt.Printf("x是bool 或 string型") default: fmt.Println("未知") }
|