for
来自「C实现的MUD,对大家基本入门网络游戏很有帮助!」· 代码 · 共 29 行
TXT
29 行
* The LPC for loop:
The LPC for loop is also identical to that provided by C. Syntax is as
follows:
for (expression0; expression1; expression2) {
statements;
...;
}
Expression0 is evaluated once prior to the execution of the loop. Expression1
is evaluated at the beginning of each iteration of the loop. If expression1
evaluates to zero, then the loop terminates. Expression2 is evaluated at
the end of each loop iteration.
A 'break' in the body of the loop will terminate the loop. A 'continue' will
continue the execution from the beginning of the loop (after evaluating
Expression2).
A typical usage of the for loop is to execute a body of code some
fixed number of times:
int i;
for (i = 0; i < 10; i++) {
write("i == " + i + "\n");
write("10 - i == " + (10 - i) + "\n");
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?