How to 'return' from a Proc?

I think ‘next’ is what you want - is this what you mean:

def x
(1…10).each {|i| yield i}
end

x {|i|
puts “before #{i}”
next if i == 5
puts “after #{i}”
}

martin

···

Kero van Gelder kero@chello.single-dot.nl wrote:

Hi!

I am trying to do

method() {

break if condition_met

}

to break out of the proc and thus finish the yield() in method()