[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: Better coding using ruby
From: "Bill Guindon" <agorilla () gmail ! com>
Date: 2006-05-31 23:43:01
Message-ID: 67a222920605311642m3b55bc33t5db3afed9daedd85 () mail ! gmail ! com
[Download RAW message or body]
On 5/31/06, Paul D. Kraus <paul.kraus@gmail.com> wrote:
>
> Itterating over an array and then having to have a counter variable to make
> "in-place" changes seems a little overkill and I am pretty certian there is
> probaly a better way.
%w[a b c d e].each_with_index do |val,idx|
puts "#{idx} = #{val}"
end
0 = a
1 = b
2 = c
3 = d
4 = e
--
Bill Guindon (aka aGorilla)
The best answer to most questions is "it depends".
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic