On Nov 14, 1:18=A0am, "Skye Shaw!@#$" <skye.s... / gmail.com> wrote:
> On Nov 14, 12:54=A0am, timr <timra... / gmail.com> wrote:
>
> > #I want to use: solve_by_iter { |test| =A0lambda{puts test; break}.call
> > if (1..6).all?{|num| test%num =3D=3D (num-1)} }
>
> What's wrong with returning a boolean value from the inner lambda and
> breaking in the block?
>
> solve_by_iter { |test| break if lambda{puts test; false}.call }

Though if you really, really -really, want to kill the call stack from
an arbitrary depth you could try (gulp):

def solve_by_iter
  counter =3D 1
  catch :break do
    loop do
      yield counter
      counter +=3D 1
    end
  end
end

solve_by_iter { |test| lambda{p test;throw :break}.call }