Iterator break/continue

Forgive me if I’m just not seeing it but is there a way to break out of an iterator (File, specificly)? This would be analgous to continue or break in C#.

Thanks.

Jeff,

Sorry, there’s no way to break out of an iterator at the moment… I’ve put it on the todo list to add this kind of functionality.

(although, there is a dodgy way to achieve a break by calling Action.Reset in the OnAfterEachIteration script event. This causes the action to fail though, instead of breaking elegantly).

.t8

A slightly more elegant way is to throw an exception, and wrap the iterator in a try/catch block. If you do that, make sure to set some variable just before you throw the exception, and test for it in the catch block, otherwise you might miss “real” exceptions.

Steve

Is this still at the top of the TODO list? I’d also like a better way to break out of an iterator. Try/catch doesn’t seem like the most intuitive way to do this.

Thanks,

Nick

Please add me to the wish list for this. I am currently using the try-catch method as suggested, but a more elegant way to break out of an iterator would be useful for my current project.

There is an Exit Loop action in the current version of FinalBuilder. Not quite sure when it was added but was a while back.

Thanks Vincent, I didn’t see that before. It works as expected.