From: Jason Mayer Date: 2006-12-28T02:17:09+09:00 Subject: Re: Newbie problem: String can't be coerced into Fixnum ------=_Part_87767_7886702.1167239827216 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 12/27/06, 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/. You were outputting a string, and adding a integer to the string. name = "Jason" puts "How old are you?" age = gets.chomp puts name + " is " + age + " years old." t = Time.now born =(t.year - age.to_i) puts "You were probably born in " + born.to_s + "." How old are you? 28 Jason is 28 years old. You were probably born in 1978. ------=_Part_87767_7886702.1167239827216--