From: Jon Garvin Date: 2006-08-09T04:02:44+09:00 Subject: Re: Simple looping question How about looping through the list backwards? Aqua Fina wrote: > I have some data in a YAML file that looks like: > > 20060712: [9.174, 131452] > 20060719: [9.466, 131805] > 20060727: [9.197, 132150] > 20060807: [9.778, 132540] > > It represents dates, gallons of gas, and mileage, respectively. > > I want to loop through and print out something like: > > The W gallons of gas purchased on X lasted Y days. The mileage was Z > miles per gallon. > > What is the best way to do this? I need the next date from the next > entry in the hash, so a simple .each won't work. I can't quite wrap my > head around this problem. > > Thanks. > >