Hi,

I have two nested "each" loops (possibly more in the future) and I need to
exit multiple levels at once on some condition. I do it like this:

$R(minX, maxX).each(function(x) {
  $R(minY, maxY).each(function(y) {
   ...
   if (someCondition)
    throw $break;
  });
  if (someCondition)
   throw $break;
});

Is it possible to use something like this instead to avoid code duplication?

loopStart:
$R(minX, maxX).each(function(x) {
  $R(minY, maxY).each(function(y) {
   ...
   if (someCondition)
    throw $break(loopStart);
  });
});

I'm using prototype 1.6.0.3.

Thank you,
  Vasily

--~--~---------~--~----~------------~-------~--~----~
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-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to