A common programming error is failure to set new values for loop variables in corner cases that are rarely used and tested.
在极少使用和测试的不重要情形中疏忽了为循环变量设置新值,这是常见的程序设计错误。
For loop conformance, consider the code snippet in Listing 3.
对于循环的一致性,可以考虑清单3中的代码片段。
The next for loop processes just the HTTP links only.
接下来将只对HTTP链接进行循环处理。
Steps [3] and [4] are repeatedly executed in a for loop.
第[3]步和[4]步可以再循环中重复执行。
We leave it as an exercise to the reader to rewrite the outermost for loop in a more elegant fashion.
我们留给读者一个练习,以更好的形式重写循环的最外层。
All you're doing is promising the compiler that the argument passed to the function will be at least that large; some machines might use this for loop unrolling.
您这样做是向编译器保证传递给那个函数的参数将至少是那么大;有一些机器可能会以此来拆解循环。
The for loop then repeatedly calls the.next method of this iterator until it encounters a StopIteration exception.
然后,for循环反复调用这个迭代器的. next方法,直到它遇到StopIteration异常为止。
That's why the main test method in Listing 1 USES a while loop instead of a new for loop.
这就是为什么清单1中的main测试方法使用while循环而不是一个新的for循环。
Now, even though the "for" loop is a very powerful construct, it is often prone to misuse.
现在,尽管“for”循环是一个非常强大的结构,但它也经常被滥用。
Most of the time, we just slap Iterator inside a for() loop or enhanced for() loop and move on, so to speak.
可以这么说,大部分时间我们只是将Iterator 随意放到for()循环或加强 for() 循环中,然后就继续其他操作了。
A while loop will rarely include the number of iterations — unless it is a for loop in disguise.
while循环很少包含迭代次数——除非它是一个伪装的for循环。
The first for loop in AlignAssignments() determines the column in which the assignment operators should be aligned.
AlignAssignments()中的第一个for循环判断其中的赋值运算符应当对齐的列。
This example USES two for loops. The outer for loop takes care of each row in The Times table, and the nested for loop takes care of the columns within each row.
本例使用两个for循环,外面的for循环关注乘法表中的每一行,嵌套的for循环关注每行内的列。
There's more: the for loop can be utilized to iterate over any object that supports the iteration metaphor, which makes the for loop very powerful.
还有更多信息:for循环可以用于迭代支持迭代metaphor的任何对象,这使for循环非常有用。
With Groovy 1.5, you can either chose the Groovy for / in, or prefer the classical for loop
在Groovy 1.5中,你可以选择Groovy的for/in构造,或者经典的for循环构造
The basic syntax of a for loop is shown in Listing 1, which also demonstrates how to use continue and break statements within a for loop.
清单1中显示了for循环的基本语法,还演示了如何在for循环中使用continue和break语句。
The for loop essentially says "for each item element, do the following."
for循环实际是说“对每个item元素,做以下事情。”
You can do this with a very simple for loop, as demonstrated in Listing 7 below.
您可以使用一个非常简单的for循环来完成这项任务,如下面的清单7所示。
The for loop and sequence indexing
for 循环和序列索引
The for loop is demonstrated in pseudocode format in Listing 10.
清单10中的伪代码格式演示了for循环。
The second for loop only finds lowercase vowels as it iterates over the original string.
第二个for 循环在迭代原始 string 时仅查找小写元音字母。
The second for loop shown in Listing 2 also iterates over all elements in the tuple.
清单2中显示的第二个for循环也迭代tuple中的所有元素。
The for loop iterates over the list of substrings, printing out each substring and its length.
for 循环迭代子字符串 list,打印每个子字符串及其长度。
The Python for loop may seem odd if you've ever used another programming language.
如果您用过其他编程语言,Pythonfor循环可能看起来有点儿古怪。
Up to this point we've been traversing the record store with a simple for loop.
至此,我们已经使用一个简单的for循环遍历了记录存储。
I used one unsupported list comprehension in my code, which I had to unroll into a regular for loop.
在代码中,我使用了一个不支持的列表,将其放入一个普通的for循环。
When you click Enter, the CDT produces generic code representing the chosen type of for loop.
单击Enter,CDT会生成代表for循环的已选定类型的通用代码。
This article has discussed the Python for loop and demonstrated some of its many USES.
本文讨论了Pythonfor循环并演示了它的一些使用方式。
Simply put, the for loop lets you iterate through the items in a collection of objects.
简单地说,使用for循环,可以迭代中对象集合的项目。
Here's an example of a for loop written on the fly (shown in Listing 19).
下面是即时编写的for循环示例(见清单19)。
应用推荐