tonys / myspleenklug.on.ca (tony summerfelt) writes:

> > But do you ever do things like iterate over them, or access them by name?
> 
> i will have to iterate over them. each planet has a ship production value. so
> the number of ships is going increase every year. for every planet i'll
> need:
> 
> a.ships =a.ships + a.production
> 
> and i need that 26 times. you can see why i'm looking for a solution.

Here I think I'd be looking at an array or some other collection:

  planets.each do |planet|
    planet.ships += planet.production
  end

or something similar.


Dave