LOOP循环指令含义,如何得出number的数值


请问怎么得出number的值为387的?

Because your program is running in loop forever mode

As already mentioned. Disable this. :slight_smile:

1 Like

number=0
第一次循环 number=0+1=1
loop 循环7 次
第一次 number=1+1
第二次 number=2+1
……
第七次 number=7+1=8
再从头判断,number不小于等于7,程序结束
是这样的逻辑吗

When program runs once, number=8 (Loop 7 times, from number=1)
I want to know , if don not disable “Program Loops Forever” , then how the program run?

Thank you, I want to know when the program go to the end of loop

Your program will cycle through the “Loop 7 times” the 7 times, and then it will revert to the “if numbers <= 7” line and continue running the program from there.

I think what’s confusing you is the BeforeStart with the “number := 0”. That line is only run once and that’s when you start the program.
It will not be run again, even though the program loops forever.

Yes,thank you
Firstly, because number=0, if=ture ,after loop 7 times ,number=8
Secondly, because number=8,if=false, so directly run loop 7 times , the result number=15
The third time, …………………… number=22
……………… number=386
Is it the correctly program logic?

Yes, that’s right. :slight_smile:


Why the result is 387? :grinning_face:

You must have stopped it while it was at 387. Your program makes it +1 every 0.01 second, so it goes VERY fast. +100 every second.

Try using a Wait of 1.0 instead of 0.01. It will maybe make more sense then.

Thank you very much :grinning_face: