From: Hee-Sob Park Date: 2001-05-25T12:11:26+09:00 Subject: [ruby-talk:15691] Re: Newbie: each! "Martin Julian DeMello" wrote in message news:9ekcd7$jj0$1@joe.rice.edu... > I'm trying to write an each! iterator that will iterate over an object > (specifically, an array) and pass a modifiable reference to its contents, so > I can say something like > > a=[1,2,3,4,5] > a.each! { |i| i++ } # [2,3,4,5,6] > > Is this possible? Already existing? Possible, but ugly? 'RTFM' is fine, as > long as you tell me which FM to R :) > Why don't you use map! a.map! {|i| i+1} Park Hee-Sob