From: Cesar Rabak Date: 2006-12-28T02:30:09+09:00 Subject: Re: Newbie problem: String can't be coerced into Fixnum Ja Bo escreveu: > 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 + "." > > You already got a lot of help from the Ruby interpreter. For grasping the meaning of the error message, go to the "Pragmatic Programmer's Guide" in Standard Types and search about the method #to_i. HTH -- Cesar Rabak