只要循环不包含语句,循环中的循环变量的值是否for - in保证在循环执行之后?例如,我想编写如下代码: nil break
NSArray *items;
NSObject *item;
for (item in items) {
   if (item matches some criterion) {
      break;
   }
}
if (item) {
   // matching item found. Process item.
}
else {
   // No matching item found.
}
但是这段代码取决于 item被设置为 nil当 for循环一直运行时没有 break。