Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
随着最近 Swift 2.2 的推出,我们已经确认 for 循环(以其传统形式)将被 Swift 淘汰,最有可能在 Swift 3 中。
for(var i = 0; i < 5; i++)
将替换为 for-in:
for i in 0 ..< 5
我读过 Swift 旨在与 C 保持一定程度的互操作性(如 Swift 2.1 发布文档中所述)。
从语言设计和规划的角度来看,为什么这是最佳选择,因为传统的 for 循环是最常用的循环类型之一,并且从一开始就包含在语言中?