I have just started playing with Swift. When using a Playground, according to Apple's iBook the following should work:
var firstForLoop = 0;
for i in 1..3 {
firstForLoop += i;
}
However, the interpreter is complaining: "Use of unresolved identifier '..'" I have tried:
var firstForLoop = 0;
for i in 1...3 {
firstForLoop += i;
}
and it works just fine (including the upper value in the loop). Has Apple removed the ..
option from Swift's grammar?
..
is now ..<
.
You're probably using an old version of the book.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With