One of the most important parts of Go is that it is a language that supports first-class functions. First-class functions are functions that have the ability to be passed to other functions as variables. They can also be returned from other functions. This is important to note because we can use them as closures.
Closures are helpful because they are a great way to keep your code DRY as well as helping to isolate your data. Keeping datasets small has been a core tenet of this book thus far, and that doesn't change in this chapter (nor any subsequent chapter). Being able to isolate the data that you wish to manipulate can help you to continue to write performant code.
Closures keep a local scope and have access to the outer function's scope and parameters, as well as global variables. Closures are functions that reference variables outside of their...