A

Admin • 833K Points
Coach

Q. How can you check if an optional contains a value?

  • (A) optional != 0
  • (B) optional != nil
  • (C) optional.exists
  • (D) optional.hasValue()
  • Correct Answer - Option(B)
  • Views: 25
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin

Comparing to `nil` is a common way to check if an optional has a value.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.