Merge pull request #83 from Hongbo-Miao/patch-2

chore: update switch case code format
pull/85/head
Xargin 2020-03-21 22:03:02 +08:00 committed by GitHub
commit bd506de4eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -8,12 +8,12 @@ Go的类型系统会在编译时捕获很多错误但有些错误只能在运
```Go
switch s := suit(drawCard()); s {
case "Spades": // ...
case "Hearts": // ...
case "Diamonds": // ...
case "Clubs": // ...
default:
panic(fmt.Sprintf("invalid suit %q", s)) // Joker?
case "Spades": // ...
case "Hearts": // ...
case "Diamonds": // ...
case "Clubs": // ...
default:
panic(fmt.Sprintf("invalid suit %q", s)) // Joker?
}
```