标签:文档 ted first items media which for循环 lse and
>When the items are exhausted (which is immediately when the sequence is empty), the suite in the else
clause, if present, is executed, and the loop terminates.
>A break statement executed in the first suite terminates the loop without executing the else clause’s suite.
A continue statement executed in the first suite skips the rest of the suite and continues with the next item,
or with the else clause if there was no next item.
根据官方文档说法:大意是说当迭代的对象迭代完并为空时,位于else的子句将执行,
而如果在for循环中含有break时则直接终止循环,并不会执行else子句。
标签:文档 ted first items media which for循环 lse and
原文地址:https://www.cnblogs.com/xiao-xue-di/p/9458886.html