Swift: using guard statements?

Example:

func greet(_ person: String?) { if person == nil { return } }
Swift offers the guard statement to handle early exits.

Solution:

func greet(_ person: String?) { guard let name = person else { return } print("Hello, (name)!") }

Beginner's Guide to Swift