for var i = 0; i < segmentArray!.count; i++ {
                
}
报错  Unary operator '++' cannot be applied to an operand of type '@lvalue Int’

替代方案

for i in 0..<self.segmentArray!.count {
    print("--->", i)
}

// 递增
for i in 0 ..< self.segmentArray!.count {              
}
            
// 递减
for i in (0 ..< self.segmentArray!.count).reversed() {          
}
            
// NON-SEQUENTIAL INDEXING     Using where
for i in (0 ..< self.segmentArray!.count) where i % 2 == 0 {            
}

 

相关文章:

  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
相关资源
相似解决方案