Issue #5893 has been updated by mame (Yusuke Endoh).

Status changed from Open to Rejected

I believe this is already solved.  Closing.

-- 
Yusuke Endoh <mame / tsg.ne.jp>
----------------------------------------
Feature #5893: named  return,next...
https://bugs.ruby-lang.org/issues/5893#change-25311

Author: neleai (Ondrej Bilka)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 2.0.0


Hello. As returning from various blocks is recurring theme at list I propose following.

You can assign label to each block. You can exit given block by referring to its label.
Syntax can be ::label to avoid ambiguity(But prettier syntax would be desirable).

return,next,break,redo would work as they do now.


Here is example

while::loop true
  10.times{|i|::outer
    10.times{|j|::inter
      next::outer    if i>6
      return::inner 42 if j>4
      puts i,j
    }
  }::outer #For readability we could optionaly add label at end of block.
  break::loop
end


-- 
http://bugs.ruby-lang.org/