From: Wojciech Kaczmarek Date: 2003-03-13T16:17:42+09:00 Subject: Re: next iteration within a block On Thu, 13 Mar 2003 14:46:49 +0900, Dave Thomas wrote: > >> What is the most short/elegant way of ending the current iteration >> within a block? My first thought was that `next' will break the >> iteration and last evaluated expr will be returned to the caller, but >> surprisingly `nil' is returned this way, so we have (Ruby 1.6.8): >> >> ['bar','quux'].map {'foo'; next; 42} >> => [nil, nil] > > Try > > [1,2].map {|i| next 'b' if i < 2; 'a'} >=> ["b", "a"] Seems that `next ' syntax is not available in 1.6.x. -- This is not a healthy way of thinking. (Emacs Psychiatrist)