| What is use of Guard statement in iOS?
There are certain conditions when one or more requirements are not going to met. And that case guard statement is used to pass program control out of that domain. Below are the some of the main advantages of guard statements:-
(1)It will helps in early exit
(2)This will avoids pyramids of doom
(3)We can also say its a another way to safely unwrap optionals
Below is the syntax for guard statement:-
guard condition else
{
statements
}
| | |