blank identifier

The underscore _ used in place of a variable name to throw away a value you do not need.

In more detail

Go reports unused variables as errors, so _ is how you ignore, for example, the index in for _, name := range names. Ignoring an error with _ is legal but usually hides a real failure.

Example

for _, name := range names {}

Related terms

Taught in

References