Repeat loop

More
26 May 2015 15:39 #59064 by mariusl
Repeat loop was created by mariusl
Hi
Does the statement "repeat [5]" count from 0 to 5 or from 1 to 5?

Regards
Marius


www.bluearccnc.com

Please Log in or Create an account to join the conversation.

More
26 May 2015 17:35 #59069 by ArcEye
Replied by ArcEye on topic Repeat loop
It does 5 iterations.

Whether it effectively does

for(x=0; x < 5; x++)

or

for(x=1; x <= 5; x++)

I don't know.
I would guess the former, as it is far more standard.

regards

Please Log in or Create an account to join the conversation.

More
26 May 2015 17:49 #59071 by mariusl
Replied by mariusl on topic Repeat loop
I was actually wondering if it did 5 or 6 repeats.

Regards
Marius


www.bluearccnc.com

Please Log in or Create an account to join the conversation.

More
26 May 2015 17:59 - 26 May 2015 18:01 #59072 by ArcEye
Replied by ArcEye on topic Repeat loop
It should do 5

linuxcnc.org/docs/html/gcode/o-code.html#sec:repeat

Put a (debug, "comment") inside the example loop and see how many times it prints

I don't actually use it, it never used to exist and I just got used to using a parameter as a counter and incrementing it, so tend to do that automatically.

I don't think there is any option to use it in do{}while() fashion and effectively increase the number of loops by one.

regards
Last edit: 26 May 2015 18:01 by ArcEye.

Please Log in or Create an account to join the conversation.

Time to create page: 0.076 seconds
Powered by Kunena Forum