From: Isaac Toothyxdip Date: 2008-02-22T01:02:31+09:00 Subject: Re: displaying user inputed arrays Thanks you all for your help i have finished my code (so far) and just have one question... is this enough to be ready to move on to making a small game? print "What is your name? " name = gets.chomp puts "Hello #{name}" print "How many years old are you? " years_old = gets.chomp.to_i hours_old = (years_old * 365) * 24 puts "Your name is #{name} and your are #{hours_old} hours old" answered = false #if person has answered y/n question print "Do you want to know how many seconds old you are #{name}? (Y/N)" while not answered #if the person hasnt answered (makes loop question if wrong answer) answer = gets.chomp seconds_old = hours_old.to_i * 60 * 60 case answer.upcase[0] #makes first letter of the answer cap and and array when "Y"[0] #if first letter of answer is y, Y then... ([0] is making y, Y first letter of array or answer) puts "You are #{seconds_old} seconds old" answered = true #leaves the while not loop when "N"[0] #same as Y but with N puts "Ok Then" answered = true #leaves the while not loop else puts "Ummm...Yes or No?" end end answered = false puts "type in a number 1-100: " while not answered print_times = gets.chomp.to_i - 1 if print_times > 100 puts "Please enter a number between 1 and 100" else answered = true end end answered = false puts "ok now type in a word 1-10 letters long: " while not answered print_word = gets.chomp if print_word.length > 10 puts "Please enter a word between 1 and 10 letters long" else answered = true end end 1.upto(print_times) do |q| puts print_word + "\n" end places = ["first", "second", "third", "fourth", "fifth"] puts "Please enter 5 words" until (a = (gets.scan /\w+/) - [""]).length == 5 puts "Please type in exactly FIVE words, thanks." end puts "You would like to print out which word number? (1-5)" until (1..5).include?(n = gets.chomp.to_i) puts "Please pick a number 1 through 5" end puts "The #{places[n - 1]} word you choose was #{a[n - 1]}" -- Posted via http://www.ruby-forum.com/.