Swift Gaurd Statement
Swift Guard statement is used as a substitute of Swift if statement. Guard statement provides benefits over if statement to control the program flow and write simple and clean code.
Note: The guard statement must contain a control statement return, break, continue or throw at the end of the code.
Condition is satisfied.
Guard statement inside a function
In Swift, we can also use a guard statement in function.
Condition is not satisfied. Hello after function call
Next TopicSwift Break Statement