R

Ravina • 2.56K Points
Extraordinary

Q. What will this code print?

Code:
var x = 5
x += 1
print(x)
  • (A) 5
  • (B) 6
  • (C) Error
  • (D) 1
  • Correct Answer - Option(B)
  • Views: 2
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Ravina
`x += 1` increments the value of `x` by 1. So, the final value is 6.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.