2016-08-06から1日間の記事一覧
題名の通り、Go言語のswitch文は暗黙でcaseの最後にbreakが入ります。 なので i := 1 switch i { case 1: fmt.Println("1") case 2: fmt.Println("2") default: fmt.Println("other") } と書くとcase 1にマッチし、case 2には入りません。 fallthrough 逆にc…
題名の通り、Go言語のswitch文は暗黙でcaseの最後にbreakが入ります。 なので i := 1 switch i { case 1: fmt.Println("1") case 2: fmt.Println("2") default: fmt.Println("other") } と書くとcase 1にマッチし、case 2には入りません。 fallthrough 逆にc…