From: Brian Burns Date: 2007-03-01T17:40:56+09:00 Subject: Re: Stepping out on a Limb - some very ugly code Well, there's always more than one way to do anything, but here's one late night hack :) #!/usr/bin/env ruby class ResumeBuilder def initialize @data = {} @fields = ['First Name', 'Last Name' , 'Address' , 'City' , 'State' , 'Zip' ] end def prompt @fields.each do |field| val = @data[field] print "Please enter your #{field}#{(' (' + val + ')') if val}:" val = gets.chomp @data[field] = val if val != '' end end def confirm? puts "You entered:" @fields.each do |field| puts field + ': ' + @data[field].to_s end print "Is this correct? (Y/n)" gets.chomp == 'Y' end end resume = ResumeBuilder.new resume.prompt resume.prompt until resume.confirm? I didn't bother with the formatting, but you get the idea. You might also look at using a Struct. -Brian -- Posted via http://www.ruby-forum.com/.