Functions
To return multiple values from a function
// Returns two decks
func deal(cards deck, handSize int) (deck, deck) {
return d[:handSize], d[handSize:]
}
To capture both function outputs:
deck1, deck2 := deal(cards, 5)
A lot of functions return an error
type:
byteslice, err := ioutil.ReadFile(filename)
if err != nil
Function Literal (unnamed, anonymous, lambda)
func() {
// some code...
}()