[docs] For ... Next

I just get an eye on the For…Next entry in the docs: it is very nice.

Real nice (thanks Kem).

One thing is missing (or I do not saw it) is:

If UserCancelled Then Exit

Press Ctrl+F on the page and type Exit. Search through the page and you will find that ‘Exit’ is documented if that’s what you mean.

Your post is too vague and does not actually tell me or probably anyone what exactly you are looking for? Posting a line of code like this does not tell me anything.

maybe he wants the quoted code to be added there as example code?

There is an entire section about Exit and Continue on the FOR/NEXT help page, not sure what else should be included there that is not already.

Thanks Emile. You’re very quick as I just did that yesterday. :slight_smile:

I did mention that exiting the loop early will leave the counter with the same value as it had at the point of exit. Is that what you mean?

All I wanted to say is:

It is safe to add this line before the Next line in your For Next loop, to avoid a potential infinite loop.

New comers may not know that, and the Language Reference is here for them (and us too).

Other example shows that at the bottom of the MenuItem page, See Also part, MenuBar does not appears.

[quote=196392:@Emile Schwarz]All I wanted to say is:

It is safe to add this line before the Next line in your For Next loop, to avoid a potential infinite loop.

New comers may not know that, and the Language Reference is here for them (and us too).

Other example shows that at the bottom of the MenuItem page, See Also part, MenuBar does not appears.[/quote]

Exiting a loop is quite fine.

The risk of infinite loop is not that great for a For Next, but it can be very real for a While/Wend or a Do Loop. Then having a way to break the loop is good. If you have a risk of infinite loop, you may want to add a Tite Out as well.

Time out ?

Yes :wink: