mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-12-25 22:38:56 +00:00
Merge pull request #83 from Hongbo-Miao/patch-2
chore: update switch case code format
This commit is contained in:
commit
bd506de4eb
@ -8,12 +8,12 @@ Go的类型系统会在编译时捕获很多错误,但有些错误只能在运
|
|||||||
|
|
||||||
```Go
|
```Go
|
||||||
switch s := suit(drawCard()); s {
|
switch s := suit(drawCard()); s {
|
||||||
case "Spades": // ...
|
case "Spades": // ...
|
||||||
case "Hearts": // ...
|
case "Hearts": // ...
|
||||||
case "Diamonds": // ...
|
case "Diamonds": // ...
|
||||||
case "Clubs": // ...
|
case "Clubs": // ...
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("invalid suit %q", s)) // Joker?
|
panic(fmt.Sprintf("invalid suit %q", s)) // Joker?
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user