如何实现WR的重复执行?
重复的步骤能不能用FOR或者while语句循环?sdlkfj8 可以写循环语句 WR的循环语句的格式是怎样的? Examplei = 1;
while (i < 21)
type (i++);
types the value of i 20 times.
for ( [ expression1 ]; [ expression2 ]; [ expression3 ]; )
statement
First, expression1 is implemented as the starting condition. While expression2 is true, the statement is executed, and expression3 is evaluated. The loop repeats until expression2 is found to be false. This statement is equivalent to:
expression1 # state initial condition
while (expression2) { # while this is true
statement # perform this statement and
expression3 # evaluate this expression
}
Example
The for loop below performs the same function as the while loop above.
for (i=1; i<21; i++)
type (i);
Note that if expression2 is missing, it is always considered true, so that
for (i=1;;i++)
type (i);
is an infinite loop.
do
statement
while ( expression );
The statement is executed and then the expression is evaluated. If the expression is true, then the cycle is repeated. This statement differs from the while and for statements in that the expression is evaluated at the end. Therefore, the loop is always executed at least once. 循环语句嘛, 在所有的语言里都是大同小异的, WR 用的是C LIKE LANGUAGE, 所以WR 的循环语句和C 是一样的. 是阿,楼上的说得很对,tsl语法上很接近C的。
页:
[1]