This commit is contained in:
Slava Zgordan
2015-07-19 05:04:56 +02:00
parent 3aee811762
commit 421f6ec83f
100 changed files with 12903 additions and 0 deletions

32
ru/02.8.md Normal file
View File

@@ -0,0 +1,32 @@
# 2.8 Summary
In this chapter, we mainly introduced the 25 Go keywords. Let's review what they are and what they do.
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` and `const` are used to define variables and constants.
- `package` and `import` are for package use.
- `func` is used to define functions and methods.
- `return` is used to return values in functions or methods.
- `defer` is used to define defer functions.
- `go` is used to start a new goroutine.
- `select` is used to switch over multiple channels for communication.
- `interface` is used to define interfaces.
- `struct` is used to define special customized types.
- `break`, `case`, `continue`, `for`, `fallthrough`, `else`, `if`, `switch`, `goto` and `default` were introduced in section 2.3.
- `chan` is the type of channel for communication among goroutines.
- `type` is used to define customized types.
- `map` is used to define map which is similar to hash tables in other languages.
- `range` is used for reading data from `slice`, `map` and `channel`.
If you understand how to use these 25 keywords, you've learned a lot of Go already.
## Links
- [Directory](preface.md)
- Previous section: [Concurrency](02.7.md)
- Next chapter: [Web foundation](03.0.md)