A

Admin • 833.24K Points
Coach

Q. What will this code output?

Code:
let x = 2.5
print(Int(x))
  • (A) 2
  • (B) 3
  • (C) 2.5
  • (D) Error
  • Correct Answer - Option(A)
  • Views: 31
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin

Converting a Double to Int truncates the decimal part.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.