From: "lrlebron@..." Date: 2006-12-28T02:30:10+09:00 Subject: Re: Newbie problem: String can't be coerced into Fixnum You have to make sure that the variable types are correct. Here's a revised version of your script name = "My name" # This variable was missing in the original code puts "How old are you?" age = gets.chomp # gets are a string by default puts name + " is " + age + " years old." t = Time.now born = t.year-age.to_i # convert age to an integer puts "You were probably born in " + born.to_s + "." #convert born to a string Hope this helps Luis Ja Bo wrote: > I am brand new to Ruby and I would greatly appreciate any help you guys > can provide! > > If this is not the correct place to post them please let me know where I > should post these types of questions. > > This very short program is just supposed to take today's date using t = > Time.now and calculating what year the user was born... > > Code: > puts "How old are you?" > age = gets.chomp > > puts name + " is " + age + " years old." > > t = Time.now > born = t.year - age > > puts "You were probably born in " + born + "." > > > Thank you!!! > > -- > Posted via http://www.ruby-forum.com/.