From: w wg Date: 2008-09-26T18:04:52+09:00 Subject: How does Array's each method change its elements ? Hi, I found Array's each method (block) changes its elements sometimes, but sometimes it don't. Please look this: a = [1,2,3,4,5] b = a.each { |x| x + 1} puts a [1,2,3,4,5] puts b [1,2,3,4,5] The array keeps no changed. But, look another: a = ["how","are","you"] b = a.each { |x| x << "-" } puts a ["how-","are-","you-"] puts b ["how-","are-","you-"] The array changed! I want to know how does Array's each method (block) change its elements ? Thank you. -- Wang