Project

General

Profile

Bug #14935

Inconsitent behaviour with puts and enumerator with different block format.

Added by puneet.sutar@gmail.com (Puneet Sutar) over 1 year ago. Updated over 1 year ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
[ruby-core:88079]

Description

Case: 1

➜  ~ ruby
puts [1,2,3].map do |i|
  puts i
end
#<Enumerator:0x007ffe930b76d0>
➜  ~
# 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.

Also available in: Atom PDF