From: Sebastian Hungerecker Date: 2007-03-01T05:04:10+09:00 Subject: Re: Stepping out on a Limb - some very ugly code Am Mittwoch, 28. Februar 2007 20:52:44 schrieb Samantha: > On 2/28/07, Samantha wrote: > > On 2/28/07, Sebastian Hungerecker wrote: > > > data=Hash.new > > > ["street number","street name","city name","state","zip code"].each do > > > |i| > > > puts("Please enter your #{i}: ") > > > data[i]=gets.chomp > > > end > Okay ... I wrote that up and it inputs things, but I have a few > questions... > > 1) After getting the information from the user, I want to be able to output > the information on the screen and get a confirmation. I'm assuming that I > do that with: > > contact_info.each do |i| > puts i > end > > Yes? So... 1) How do I get this to be 'pretty' or formatted nicely like > the original code, and 2) How do I get the state abbreviation as all > upcase? Just use contact_info["x"] to access information x (e.g. contact_info["street name"] to access the street name), assuming contact_info is what you called the hash (although I would recommend just calling it info, because that's less to type ;-) ) -- Ist so, weil ist so Bleibt so, weil war so