Go言語で以下のように定数を設定したのですが、
lang
1package main 2 3import "fmt" 4 5const ( 6const00 = iota 7const01 8const02 9 10const10 = 10 11const11 12const12 13) 14 15func main() { 16 fmt.Println(const00) // 0 17 fmt.Println(const01) // 1 18 fmt.Println(const02) // 2 19 20 fmt.Println(const10) // 10 21 fmt.Println(const11) // 10 (11と出てほしい) 22 fmt.Println(const12) // 10 (12と出てほしい) 23}
const11が11、const12が12 となって欲しいのですが、両方とも10になります。
希望通りに定数を設定するにはどすすればよいですか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。