Bronze Challenge
guard
statements support the use of where
clauses.
Using a where
clause with a guard
statement gives you further control over the statement’s condition.
Refactor the greetByMiddleName(_:) function to have a where
clause in its guard
statement.
This where
clause should check to see if the middle name is fewer than 4 characters.
If it is, then greet that person by their middle name.
If it is not, then use the generic greeting.
Get Swift Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.