Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift non Inclusive Range with Double Dot

Tags:

swift

for i in 0..100 {
    println("\(i)")
}

I different types of errors depending on the location of the statements:

  • Operator is not a know
  • Use of unresolved identifier '..'
  • Braced block of statements is an unused closure
like image 809
sonics876 Avatar asked Sep 28 '14 10:09

sonics876


1 Answers

The half-closed range operator has been changed to '..<' since Xcode beta 3. See release doc here https://developer.apple.com/swift/blog/?id=3

The error message will disappear if you do this:

for i in 0..<100 {
    println("\(i)")
}
like image 155
Anthony Kong Avatar answered Nov 12 '22 11:11

Anthony Kong