Hello I need to exit iterator when some condition finded: this.regexps.each( function(pair) { if (value.match(pair.value)) { // pair.value is a RegExp object this.current = pair.value; $(''where'').update(''in \'''' + pair.key + ''\''''); // return; break; ? or how? } } ); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey Toaple, Use this in your iterator: throw $break; http://prototypejs.org/api/enumerable/each -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/23/07, toapole maktonk <vividsnow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello > > I need to exit iterator when some condition finded: > > this.regexps.each( > function(pair) { > if (value.match(pair.value)) { // pair.value is a RegExp object > this.current = pair.value; > $(''where'').update(''in \'''' + pair.key + ''\''''); > // return; break; ? or how? > } > } > ); > >Hi, You have to use throw $break; See http://prototypejs.org/api/enumerable/each for details Yours, Nicolas Terray --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---