A

Admin • 833K Points
Coach

Q. What will this code print?

Code:
let value = "123"
let number = Int(value)
print(number ?? 0)
  • (A) 123
  • (B) Optional(123)
  • (C) 0
  • (D) nil
  • Correct Answer - Option(A)
  • Views: 23
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin

`Int(value)` successfully converts the string and `??` unwraps it to 123.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.