Skip to content

Commit 6d28146

Browse files
committed
update lesson2 and lesson8
1 parent d3665a0 commit 6d28146

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

workspace/lesson2/grammar.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,20 @@ func main() {
2727
var local_var bool
2828
local_var = true
2929
fmt.Println(local_var)
30-
}
30+
31+
/*
32+
浮点数只有float32 and float64这2种类型,没有float类型
33+
*/
34+
var data float32 = 0
35+
fmt.Println(data)
36+
37+
38+
var be byte = 255
39+
fmt.Println(be)
40+
41+
var ru rune = -2147483648
42+
fmt.Println("[func|main]ru=", ru)
43+
44+
var up uintptr = 100
45+
fmt.Println("[func|main]up=", up)
46+
}

workspace/lesson2/readme.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
# 数据类型
2-
* 数字
3-
* 整数
4-
* 浮点数
5-
* 复数
6-
* 字符串
7-
* bool
1+
# 数据类型
2+
* 数字
3+
* 整数:int, uint8, uint16, uint32, uint64, int8, int16, int32, int64
4+
* 浮点数:float32, float64
5+
* 复数:complex64, complex128
6+
* 字符串:string
7+
* bool
8+
* 其它数字类型
9+
* byte:类似uint8,数据范围0-255,定义的时候超过这个范围会编译报错
10+
* rune:类似int32,数据范围-2147483648-2147483647
11+
* uint:32位或64位
12+
* uintptr: 无符号整数,是内存地址的整数表示形式,应用代码一般用不到(https://stackoverflow.com/questions/59042646/whats-the-difference-between-uint-and-uintptr-in-golang)

workspace/lesson8/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@
145145

146146
* 函数高级用法
147147

148-
* 函数作为另一个函数的实参
148+
* 函数作为另一个函数的实参:函数定义后可以作为另一个函数的实参
149149
* 闭包
150150
* 方法

0 commit comments

Comments
 (0)