Golang in sixty seconds — function basics

Richard Bell
2 min readAug 4, 2022
Black dog dressed in clothes looking at camera
Photo by charlesdeluvio on Unsplash

In any programming language a function can often be thought of as a black box that will perform an action. They can take inputs and return outputs, but they don’t have to do either. They’re most often used to separate code to aid readability and understanding, and to avoid repetition.

In Go, a function looks like this:

func add(num1 int, num2 int) int {
return num1…

--

--

Richard Bell

Father to two beautiful baby girls | Husband to a generous wife | Lead Software Engineer | Hobby collector | Support me at ko-fi.com/richardtbell