On 12/1/05, Simon Strandgaard <neoneye / gmail.com> wrote: > On 12/1/05, Matthew Feadler <matthew / feadler.com> wrote: > > Since I've gotten the go-ahead from Christer, here's a little newbie app > > I just wrote and am looking for advice on how to better write: > [snip] #Init Array to hold shortnames of the 8 Attributes attributeShortNames = Array.new attributeShortNames[0,7]=["Int", "Per", "Str", "Sta", "Pre", "Com", "Dex", "Qik"] can simplified: attributeShortNames=["Int", "Per", "Str", "Sta", "Pre", "Com", "Dex", "Qik"] which again can be even more simpified: attributeShortNames=%w(Int Per Str Sta Pre Com Dex Qik) #Init Hash to hold shortname/fullname pairs for the 8 Attributes attributeNameMap = Hash.new count = 0 attributeShortNames.each do |name| attributeNameMap[name]= attributeFullNames[count] count += 1 end can be simplified: attributeNameMap = Hash[*(attributeShortNames.zip(attributeFullNames).flatten)] -- Simon Strandgaard