In general, it's best to file documentation bug reports on

But in this case I'll save you the trouble: Using `$break` to break
out of `each` loops is deprecated and will be removed in future
versions, not least because ECMAScript now has its own `forEach` which
doesn't have this feature. You can do it yourself, of course (just
define your own $break-like object and do the catch), but it may be
better to use Enumerable#some[2] and return true from the interator
when you want to break out of the loop (because then you don't throw
an exception for a normal case; exceptions are for *exception*
conditions, not normal ones).

[1] https://prototype.lighthouseapp.com/projects/42103/home
[2] http://api.prototypejs.org/language/enumerable/prototype/some/

T.J. Crowder
Independent Software Consultant
tj / crowder software / com

On May 31, 4:25 pm, MachiaveLuc <machiave...@gmail.com> wrote:
> Hi!
> When we go tohttp://api.prototypejs.org/, there's an important note
> missing about "each": how to break out of the loop.
> The old documentation mentionned "throw $break" and "throw $continue".
> Someone should update the new doc with this important concept.
> MachiaveLuc

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to