Hi,

In message "[ruby-talk:22893] Possible RCR? - break <n> for nested loops"
    on 01/10/22, Wayne Vucenic <wvucenic / netgate.net> writes:

|A month or two ago on this mailing list there was a discussion of the
|best way to break out of nested loops.  I think a minor change to Ruby
|would allow an elegant way to do this.

As I stated in the Ruby Conference, official answer for this request is:

  use catch and throw.

Like the following.

  catch (:matched) do
    for i in 0..5
      for j in 5..8
        if i == j
          throw :matched
        end
      end
    end
  end

  if i == j
      print "match\n"
  else
      print "nomatch\n"
  end

							matz.