From: shyouhei@... Date: 2016-07-27T04:23:36+00:00 Subject: [ruby-core:76582] [CommonRuby Feature#12623] rescue in blocks without begin/end Issue #12623 has been updated by Shyouhei Urabe. Dmitriy Non wrote: > ~~~ruby > list.each { |x| > # do something > rescue > # do something > } > ~~~ -1. This is odd. I cannot remember any other language syntax that goes likes this. Java, C++, C# and all other language that use {} as block notations share this syntax to write exception handlings: ```csharp static void Main() { try { // something } catch (Exception e) { // something } finally { // something } } ``` ---------------------------------------- Feature #12623: rescue in blocks without begin/end https://bugs.ruby-lang.org/issues/12623#change-59807 * Author: Dmitriy Non * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Hi there! There's pretty nice feature that we can use "short rescue" in method definitions: ~~~ruby def my_method raise '1234' rescue puts 'rescued' end ~~~ What about using this in blocks? ~~~ruby loop do n = enumerator.next # do something rescue StopIteration end ~~~ P.S. actually I am not sure if this FR was not created earlier but I couldn't google it. P.P.S sorry for my english -- https://bugs.ruby-lang.org/ Unsubscribe: