Listing 9 shows the beginning of the main program loop.
清单9展示了主程序循环的开始部分。
Listing 2 shows the beginning of the main program loop.
清单2显示了主程序循环的开头。
Listing 3 starts the main program loop and reads the synclient output.
清单3将启动主程序循环并读取synclient输出。
Listing 4 shows the beginning of the three-finger detection in the main program loop.
清单4显示了主程序循环中的三指检测的开始部分。
To switch between modes, an additional check is required in each pass of the main program loop.
要在模式间进行切换,需要对主程序循环的每次循环执行额外的检查。
Create a hash keyed on E-mail address for each state name, to be checked in the main program loop.
创建与每个州名的电子邮件地址绑定的散列,将在主程序循环中检查该散列。
In the main program loop, there is no need for the code that ignores the header lines and the first two lines of input.
在主程序循环中,代码无需忽略标题行和输入的前两行。
With the base variable declarations and subroutine complete, the program moves on to the main program loop, shown below.
完成了基本变量声明和子例程后,程序将继续进行主程序循环,如下所示。
Now we have started our main program loop, the part of our program which will repeat over and over checking for updates to the game.
现在开始我们程序的主循环,这一部分将反复的更新信息和检查按钮状态等。
An application's message loop is an internal program loop that retrieves messages from a thread's message queue, translates them, and then sends them to the application to be handled.
应用程序的消息循环是内部程序循环,它从线程的消息队列检索消息,然后转换这些消息,之后将它们发送给要处理的应用程序。
Some memory leaks occur due to program errors in which infinite loop in the application code allocates new objects and adds them to a data structure accessible from outside the program loop scope.
有些内存泄漏是由于程序错误发生的,在存在此类错误的情况下,应用程序代码中的无限循环会分配新的对象,并将其添加到可从程序循环范围外面访问的数据结构中。
In each case, I ran a simple program that measured the run time of a loop calling a method 10,000,000 times, calling both a synchronized and an unsynchronized version, and compared the results.
在每一个实例下,我运行一个简单的程序,测定循环调用一个方法10,000,000次所需的运行时间,我调用了同步和非同步两个版本,并比较了结果。
You can now call this method and interrupt execution at any point of the loop, capturing the state of the program.
现在,可以调用这个方法并在循环的任意位置中断执行,这会捕获程序的状态。
While it could have been written as a loop, the one-line solution is much cleaner that way, and does not slow the program down significantly.
虽然我们本来可以把它写成循环,但是长度只有一行的解决方案要清楚得多,并且不会显著降低程序运行的速度。
In my experience, it will usually be a particular inner or nested loop, or a call to some third party library methods, which is the main culprit for running the program slow.
以我的经验来看,导致程序运行速度慢得罪魁祸首可能就是某个内部或嵌套循环,也可能是对第三方库函数的调用。
This means the program statements executed in the loop body must change the value of the expression — or else the loop will never end.
这意味着循环体中执行的程序语句必须要改变表达式的值,否则循环将无法结束。
Finally, a feedback loop was incorporated into the training program.
最后,一个反馈环节被加入培训项目。
This code is pretty straight forward: if the program would halt on itself, then SELF-HALT goes into an infinite loop. Otherwise, it halts.
这段代码非常清晰:如果程序在自运行时停机,则SELF-HALT进入死循环,否则SELF-HALT停机。
In this loop, the program continually waits for new messages to be sent from the X server.
在该循环中,程序一直等待从x服务器发出的新消息。
No DOES-HALT program exists. If it did, we would be able to generate contradictions such as the above -- a program that halts when it should loop forever, and that loops forever when it halts.
DOES-HALT永远不会存在,假如它存在的话就会产生上述悖论——当一个程序无限循环时才会停机,并且当它停机时才会无限循环。
The example program USES a simple loop.
示例程序使用一个简单的循环。
The effect is shown graphically in Figure 3: a traditional program would execute the loop sequentially, whereas the OpenMP implementation creates threads to parallelize the for block.
图3中图形化地显示了其效果:传统的程序将连续地执行循环,而OpenMP实现则创建多个线程,从而并行地执行for块。
A simple example is a loop that computes a particular function for multiple arguments, such as the following Fortran program.
一个简单的例子就是为多个论断计算特定函数的循环,例如接下来的Fortran程序。
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时执行的程序语句块。
Since the ServiceStatus structure is global to the whole program, the worker loop in ServiceMain stops after the current state changes and the service thread terminates.
由于ServiceStatus结构对于整个程序而言为全局量,ServiceStatus 中的工作循环在当前状态改变或服务终止后停止。
Tracing the logic flow through the program, you see that the first time through the loop, the value of the variable I becomes 5.
通过跟踪程序的逻辑流可以看到,第一次通过循环后,变量i的值变为5。
For the test program, we'll simply have a key listener loop up or down based on whether the left or right shift key is pressed, as shown in Listing 5.
对于测试程序,我们只简单地让键侦听器根据按下的是左还是右shift键按向上或向下的方向循环,如清单5所示。
At the end of the day, you can implement the exact same program using a while loop that you can using a for loop, it's just your code is going to look slightly different.
最终,你可以执行这个程序,再使用for循环的地方使用while循环,这只是使你的代码看起来稍微有点不同。
This article has introduced three Python program statements: the if statement, the while loop, and the for loop.
本文介绍了三种Python程序语句:if语句、while循环和for循环。
If the program works for both instances of the loop, you can assume it will work for all of them.
如果程序能为这两个循环都工作的话,你能假设它能为所有的循环工作。
应用推荐