Swift -- for 循环 Unary operator '++' cannot be applied to an operand of type '@lvalue Int'
2018-01-15 20:10
375 查看
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 { }
相关文章推荐
- Swift编程语言中如何实现自定义类型的for-in循环(基于Swift 2.2)
- Swift循环之 for-in
- swift3 for 反序循环
- swift-for循环遍历,遍历字典,循环生成数组
- swift for、for-in循环
- Swift 循环for&while
- [Swift]语法基础:for循环的使用
- Swift学习——使用if和switch来进行条件操作,使用for,while,和do-while来进行循环(三)
- Swift 中 for 循环
- ios教程笔记,第三节 swift中的switch,for循环和while循环
- swift for-in循环中"..."与".."的区别
- 学校学习ios教程笔记,第三节swift中的switch,for循环和while循环
- swift 关于for循环写出多个控件
- swift基本语法(总结提炼版)之004 Swift之 for 循环
- 关于swift for 循环 遍历数组删除元素的bug问题
- iOS -Swift 3.0 -for(循环语句用法)
- swift学习-(for in)循环
- 4.4 Swift中for循环语句
- swift中c风格的for循环执行效率
- 09.swift循环(for)