Files
build-web-application-with-…/zh-tw/02.8.md
2019-02-26 01:40:54 +08:00

33 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2.8 總結
這一章我們主要介紹了Go語言的一些語法透過語法我們可以發現Go是多麼的簡單只有二十五個關鍵字。讓我們再來回顧一下這些關鍵字都是用來幹什麼的。
```Go
break default func interface select
case defer go map struct
chan else goto package switch
const fallthrough if range type
continue for import return var
```
- var和const參考2.2Go語言基礎裡面的變數和常量申明
- package和import已經有過短暫的接觸
- func 用於定義函式和方法
- return 用於從函式返回
- defer 用於類似解構函式
- go 用於併發
- select 用於選擇不同型別的通訊
- interface 用於定義介面參考2.6小節
- struct 用於定義抽象資料型別參考2.5小節
- break、case、continue、for、fallthrough、else、if、switch、goto、default這些參考2.3流程介紹裡面
- chan用於channel通訊
- type用於宣告自訂型別
- map用於宣告map型別資料
- range用於讀取slice、map、channel資料
上面這二十五個關鍵字記住了那麼Go你也已經差不多學會了。
## links
* [目錄](<preface.md>)
* 上一節: [併發](<02.7.md>)
* 下一章: [Web基礎](<03.0.md>)