Although this is ancient, this still confuses me sometimes. I needed this for a more complicated use case with [].select {|x| }/[].reject {|x| }.
Common Use case
[1,2,3,4,5].select{|x| x % 2 == 0 }
=> [2, 4]
But I needed to yield a specific value for each iteration and continue processing
With more complicated logic:
[1,2,3,4,5].select{|x| if x % 2 == 0; next true; end; false }
=> [2, 4]
# you can also use `next(true)` if it's less confusing
Also, since it's relevant to the thread, using break here will emit the single value you pass in if the conditional hits:
[1,2,3,4,5].select{|x| if x % 2 == 0; break(true); end; false }
=> true
[1,2,3,4,5].select{|x| if x % 2 == 0; break(false); end; false }
=> false
[1,2,3,4,5].select{|x| if x % 2 == 0; break('foo'); end; false }
=> "foo"