This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sectionLoop: for section in sections { | |
rowLoop: for row in rows { | |
if row.isMagical { | |
break sectionLoop | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Like an if statement, guard executes statements based on a Boolean value of an expression. | |
// Unlike an if statement, guard statements only run if the conditions are not met. | |
// You can think of guard more like an Assert, but rather than crashing, you can gracefully exit. | |
func fooGuardNonOptional(x: Int) { | |
guard x > 0 else { | |
// Value requirements not met, do something | |
return | |
} | |
NewerOlder