Skip to content

Glossary: Software Design Patterns in Go

Closure

Also written: closures

A function that remembers variables from the place where it was created. `percentOff(10)` returns a function that remembers `pct`, so one helper can make any percentage discount.

Where the book teaches it

Related terms

StrategyFunction type