Skip to content

Commit 48addcc

Browse files
committed
error处理
1 parent 6351e54 commit 48addcc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

11.1.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ error是一个内置的类型变量,我们可以在/builtin/包下面找到相
4343
}
4444
// implementation
4545
}
46+
47+
我们在调用的地方可以这样处理错误:
48+
49+
f, err := Sqrt(-1)
50+
if err != nil {
51+
fmt.Println(err)
52+
}
4653

4754
## 自定义Error
4855

0 commit comments

Comments
 (0)