A

Admin • 670.22K Points
Coach

Q. What will this Swift code print?

Code:
let greeting = "Hello"
print(greeting.hasPrefix("He"))
  • (A) true
  • (B) false
  • (C) He
  • (D) Hello
  • Correct Answer - Option(A)
  • Views: 1
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Admin
`hasPrefix("He")` returns true because the string starts with 'He'.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.