Functions
Functions are central in Go+. We’ll learn about functions with a few different examples.
Here’s a function that takes two int
s and returns
their sum as an int
.
Go+ requires explicit returns, i.e. it won’t automatically return the value of the last expression.
When you have multiple consecutive parameters of the same type, you may omit the type name for the like-typed parameters up to the final parameter that declares the type.
Call a function just as you’d expect, with
name(args)
.
Next example: Multiple Return Values