irb(main):007:0> %w[1 2 3 4 5]&.each { |a| puts a }
1
2
3
4
5
=> ["1", "2", "3", "4", "5"]
irb(main):008:0> %w[1 2 3 4 5].each { |a| puts a }
1
2
3
4
5
=> ["1", "2", "3", "4", "5"]
Both &.each
and .each
seems to give the same results
ruby-doc doesn't seem to have anything regarding this functionality
What is the difference between the two?