A

Admin • 670.22K Points
Coach

Q. What will this Swift code print?

Code:
let value = "42"
if let intValue = Int(value) {
print(intValue * 2) }
  • (A) 84
  • (B) 42
  • (C) Error
  • (D) nil
  • Correct Answer - Option(A)
  • Views: 1
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin
`Int(value)` converts the string to integer, then multiplies by 2.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.