From: Harry Truax Date: 2004-08-14T04:55:57+09:00 Subject: Re: Question: A method for summing several variables Lennon, Thanks for the quick reply. Unfortunately, I am required to use the box variables (box1_1, box12_24,...etc.). Harry ----- Original Message ----- From: "Lennon Day-Reynolds" To: "ruby-talk ML" Sent: Friday, August 13, 2004 3:40 PM Subject: Re: Question: A method for summing several variables > Harry, > > The natural way to handlie this kind of problem in Ruby would be to > store the form field values in a two-dimensional array, rather than as > specially-named variables. That way, you can use the built-in > iteration functionality that Ruby arrays support to loop through > fields, total them, etc. > > I'd recommend looking at the "Containers, Blocks, and Iterators" > chapter of the Pickaxe book > (http://rubycentral.com/book/tut_containers.html) to see how this kind > of object collection is handled in "idiomatic" Ruby code. > > If you need more specific help, just let us know. > > Lennon > >