I have code that loops through each rune of a string like so:
for i, character := range "abcdefghjklmnopqrstuv" {
fmt.Printf("character and i: ", character, i)
}
However, I have no need do anything with i
. I only need that for the loop to work. If I leave i
out of fmt.Printf
, the compiler complains that I have defined something I did not use. If I leave i
in, it clutters my console output.
How can I can tell the compiler to ignore the unused variable?