Functions – Reduce, Reuse, and Recycle
Overview
This chapter will describe the various ways in which you can reduce, reuse, and recycle code. It will include a large overview of functions so that you can include parts of a function, such as defining the function, function identifiers, parameter lists, return types, and the function body. We will also look at best practices when designing code so that you can make it reusable and flexible and make your functional logic small and purposeful.
By the end of this chapter, you will be able to see how easy Go makes it to reduce, reuse, and recycle code. This will include how to describe a function and the different parts that make up a function and evaluate the scope of variables with functions. You will know how to create and call a function, as well as how to utilize variadic and anonymous functions and create closures for various constructs. You will also know how to use functions as parameters and return values and how to...