0 votes
in Swift by
What is a GUARD statement? What is the benefit of using the GUARD statement in swift?

1 Answer

0 votes
by
A GUARD statement is used to transfer the program control out of the scope when one or more conditions are not met. Using this statement helps in avoiding the pyramid of doom.

A GUARD statement will be in the following form:

guard condition else

{

Statements

}

Related questions

0 votes
asked Nov 6, 2022 in Swift by rajeshsharma
0 votes
0 votes
asked Nov 7, 2022 in Swift by Robin
...