Swift: Implicit Return Not Compiling?

Viewed 212

I was checking out the Swift documentation on implicit returns. Consider this function from the docs:

func greeting(for person: String) -> String {
    "Hello, " + person + "!"
}

When I copy and paste it into xCode I get an error: "Missing return in a function expected to return 'String' "

My swift version is set to 5.0 in build settings.

Honestly don't know if I am missing something obvious here, or if there is a problem with my other xCode build settings? Ideas?

0 Answers
Related