From: lucasbuchala@... Date: 2018-07-24T17:13:07+00:00 Subject: [ruby-core:88082] [Ruby trunk Bug#14935] Inconsitent behaviour with puts and enumerator with different block format. Issue #14935 has been updated by lucasbuchala (Lucas Buchala). I think this is because `do ... end` blocks has lower precedence than `{...}` blocks. As documented in [1]. So, probably, not a bug. ~~~ method1 method2 { ... } # method2's block method1 method2 do ... end # method1's block ~~~ [1] http://ruby-doc.org/core-2.5.1/doc/syntax/calling_methods_rdoc.html#label-Block+Argument ---------------------------------------- Bug #14935: Inconsitent behaviour with puts and enumerator with different block format. https://bugs.ruby-lang.org/issues/14935#change-73104 * Author: puneet.sutar@gmail.com (Puneet Sutar) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- ### Case: 1 ``` ��� ~ ruby puts [1,2,3].map do |i| puts i end # ��� ~ # block does get evaluated. ``` Case 2: ``` ��� ~ ruby puts [1, 2, 3].map { |i| puts i } 1 2 3 ��� ~ # Block gets evaluated. ``` My question is Shouldn't both cases give consistent output. -- https://bugs.ruby-lang.org/ Unsubscribe: