This is neat.
I used for loops because i wanted to index array like you explained.
Thanks,
Manish



On 07/20/2006 08:41 PM, Chris McMahon wrote:
> On 7/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>   
>> Does these constructs provide the current index value somehow?
>> Regards,
>> Manish
>>     
>
> There are probably lots of ways to do that.  Here's one, if I
> understand the question correctly:
>
>
> list = ["foo","bar","baz"]
>
> 0.upto 2 do |x|
>   puts "index " + x.to_s + " : " + list[x]
>   end
>
>   
>> ruby bah.rb
>>     
> index 0 : foo
> index 1 : bar
> index 2 : baz
>   
>> Exit code: 0
>>     
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>   

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to