A

Admin • 828.03K Points
Coach

Q. What will this code output?

Code:
let age = 18
print(age >= 18 ? "Adult" : "Minor")
  • (A) Adult
  • (B) Minor
  • (C) true
  • (D) false
  • Correct Answer - Option(A)
  • Views: 12
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin
The ternary operator evaluates to 'Adult' since the condition is true.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.