From: Morton Goldberg Date: 2006-08-29T10:42:17+09:00 Subject: Re: That's Ruby, Virginia! I don't want to rain on your parade, especially because I can't figure out why you're having a parade. I could understand a newbie being puzzled about this code (because he wrote [0 ... length] where he should used 0 ... length) and posting it so someone could explain why it works the way it does, but you say that's not your situation. Could you be more explicit about what amuses, delights, intrigues, or otherwise motivates you to bring this to our attention? Regards, Morton On Aug 28, 2006, at 1:26 PM, Henry Savr wrote: > Well, that is a modification. No public\private\irb etc... :))) > > =============Program ==================== > #Version 2. For native Ruby > puts "Source is: #$0" > puts "File is: #{__FILE__}" > > class Array > def array_101A > for i in [0 ... self.length] > puts "#{i} => #{self[i]}" > end > end > end > > a = ['a','s','d'] > a.array_101A > > =========== Results ====================== > C:\Documents and Settings\Admin>ruby -w c:/PJ/play/test/lib/t3.rb > Source is: c:/PJ/play/test/lib/t3.rb > File is: c:/PJ/play/test/lib/t3.rb > 0...3 => asd > > -- > Posted via http://www.ruby-forum.com/. >