5. Functions

Overview

This chapter will describe the various parts of a function in detail, such as defining the function, function identifiers, parameter lists, return types, and the function body. We will also look at some best practices when designing our functions, such as a function performing a single task, how to reduce code, making your function small, and ensuring that functions are reusable.

By the end of this chapter, you will be able to describe a function and the different parts that make up a function and evaluate the scope of variables with functions. You will learn to create and call a function; utilize variadic and anonymous functions and create closures for various constructs. You will also learn to use functions as parameters ...

Get The Go Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.