From: Robert Klemme Date: 2013-03-06T06:25:04+09:00 Subject: Re: How `next` works in ruby with `unless` ? On Tue, Mar 5, 2013 at 8:07 PM, Hans Mackowiak wrote: > they values you used for next are returned by yield ... > (so all block functions that does something different depending on the > block result does be affected like: .map, .select, .find, .group_by and > others ) Like with: irb(main):025:0> 10.times.map {|i| next if i == 2;i*10} => [0, 10, nil, 30, 40, 50, 60, 70, 80, 90] "next" is for a block about the same as a "return" for a method: the current call is terminated at this point with the provided arguments given to the caller (the "yield"). And since "next" is a keyword it does make sense to have it follow the same syntax rules for arguments like "return" and "break". Hans, thank you for the heads up! Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/