Question:

What output will be produced by the code below?

for i in 3...1 {
    print(i)
}

Answer:

Correct answer: This code will compile but crash.

Explanation: This code will be compiled successfully, but crash at runtime: Swift does not allow you to generate ranges where the initial value is greater than the end value.


Keywords:

© 2017 QuizBucket.org