Question:

What output will be produced by the code below?

let names = ["Simon", "River", "Book"]

names.forEach {
    print($1)
}

Correct answer: This code will not compile.

Explanation: When using forEach you are given each item of an array using the value $0. This code incorrectly tries to use $1, and so will not compile.


Keywords:

© 2017 QuizBucket.org