The while loop, as was the case with the if statement, supports an optional else clause containing a block of program statements executed when the expression is False.
while循环与if语句一样,支持一个可选的else子句,其中包含一个当表达式计算为False时执行的程序语句块。
For a while loop, however, this means the code in the else clause is executed once, after the loop is terminated (see the pseudocode shown in Listing 7).
但是对于while循环,这意味着在循环终止后,else子句中的代码被执行一次(参见清单7中的伪代码)。
Selecting any mapping statement in the Script Pane shows all source and target mappables referenced in the statement, such as mapping source, loop iterator, condition, where clause, and so on.
在Script窗格中选择任何映射语句,这将显示该语句中所引用的所有源和目标可映射对象,如映射源、循环迭代器、条件、where子句,等等。
This makes the SELECT clause a code loop.
这使select子句成为代码循环。
One special feature of the break statement is that it breaks completely out of the loop, thereby skipping any else clause that follows the loop.
break语句的一个特殊特性是,它完全中断循环,并跳转到循环下面的任一个else子句。
The expression used in the if statement (and in the elif clause and the while loop discussed later in this article) can be as complex as necessary.
if语句(以及本文后面讨论的elif子句和while循环)中的表达式可以很复杂。
Once the code has iterated over all the elements in the tuple, it enters the else clause of the for loop, which prints out the value of the count variable.
一旦代码已经迭代了tuple中的所有元素,它将进入for循环的else子句,打印count变量的值。
At this point, the break statement causes program execution to break out of the while loop, skipping the else clause.
此时,break语句导致程序执行中断while循环,跳转到else子句。
Listing 7 defines a sequence of names, and then USES a for clause to loop through this sequence, retrieving each name and adding it to a node collection.
清单7定义一个序列名,然后使用一个for子句遍历该序列,获取每个名称并将其添加到节点集合中。
Listing 7 defines a sequence of names, and then USES a for clause to loop through this sequence, retrieving each name and adding it to a node collection.
清单7定义一个序列名,然后使用一个for子句遍历该序列,获取每个名称并将其添加到节点集合中。
应用推荐