For loop (for)循环迭代多少次?
基本问题:For loop (for)循环迭代多少次?,for-loop,For Loop,基本问题: for(int i=start;i<=end;i+=step){ System.out.println("Test"); } for(inti=start;i我们需要知道start、end和step的值是什么 if: start = 0; end = 10; step = 1; 它将循环11次,每次在i的前一个值上加1,直到Yourforloop是以下代码的缩写: int i = start; if (i <= end) { /* loop
for(int i=start;i<=end;i+=step){
System.out.println("Test");
}
for(inti=start;i我们需要知道start、end和step的值是什么
if:
start = 0;
end = 10;
step = 1;
它将循环11次,每次在i的前一个值上加1,直到Yourfor
loop是以下代码的缩写:
int i = start;
if (i <= end) {
/* loop body */
i += step;
}
inti=start;
如果(i-Trick-question)是start
?你是否弄乱了体中的i
?start天花
函数。这就是重点。我需要知道(数学)用变量而不是值来回答。或者,我们可以给出一个数学函数,包括开始
,结束
,和步骤
。
if:
start = 10;
end = 100;
step = 10;
int i = start;
if (i <= end) {
/* loop body */
i += step;
}