初級 › declared and not used: の原因と直し方 › パターン1
declared and not used: の原因と直し方
Goでは変数を宣言しても一度も使わないとコンパイルエラーになります。
1 package main 2 3 import "fmt" 4 5 func main() { 6 count := 5 7 __________________ ^ 8 fmt.Println("done") 9 }
./main.go:6:5: declared and not used: count
空欄を埋めて実行を通す
countを宣言しても一度も使っていません。使わない変数は_に代入するか、削除する必要があります。
次の問題