multiple return values

A Go function returning more than one result at once, most often a useful value together with an error.

In more detail

The caller receives both, as in value, err := divide(10, 2), and must check err before trusting value. This keeps failures visible at every call instead of hidden in exceptions. Use the blank identifier _ for a result you deliberately ignore.

Example

pct, err := usage(200, 164)

Related terms

Taught in

References