R

Ravina • 2.56K Points
Extraordinary

Q. What will this code output?

Code:
let name = "Swift"
for char in name {
print(char)
}
  • (A) S w i f t
  • (B) Swift
  • (C) Each character on a new line
  • (D) Error
  • Correct Answer - Option(C)
  • Views: 1
  • Filed under category Swift (iOs)
  • Hashtags:

Explanation by: Ravina
The loop iterates over each character and prints them one per line.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.