R

Ravina • 3.96K Points
Extraordinary

Q. What does the `as?` operator do in Swift?

  • (A) Performs forced type casting
  • (B) Checks type only
  • (C) Performs conditional type casting
  • (D) Declares a variable
  • Correct Answer - Option(C)
  • Views: 15
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Ravina

`as?` attempts to cast to a specified type and returns `nil` if it fails.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.