Intro

Functions group operations into a unit of code.

A function is defined with the func keyword

A function name, its parameters and return types make up a functions signature

go
// Basic function that accepts no arguments and returns nothing
func stuff() {
    // do stuff
}

// Function that accepts an argument
func stuff(s string) {
    // do stuff with 's'
}

// Function that accepts arguments and returns a string
func stuffAndThings(s string, t string) string {
    return s + t
}

// Function that accepts arguments and returns multiple strings
func stuffAndThings(s string, t string) (string, string) {
    // do stuff with s and t.
    return s, t
}
# golang