What causes "unexpected non-void return value in void function" in swift?

Example:

func greet() {
    return "Hello"
}
The error is triggered when a function that is not supposed to return a value does so.

Solution:

func greet() -> String {
    return "Hello"
}

Beginner's Guide to Swift