R

Ravina • 2.56K Points
Extraordinary

Q. What is the purpose of the `guard` statement in Swift?

  • (A) To loop through collections
  • (B) To ensure a condition is true, or exit early
  • (C) To define a function
  • (D) To catch an exception
  • Correct Answer - Option(B)
  • Views: 1
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Ravina
`guard` helps to validate conditions and exit the current scope if the condition is not met.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.