From: Logan Capaldo Date: 2006-12-20T03:53:59+09:00 Subject: Re: Problem with string comparison ------=_Part_12546_25953392.1166554435840 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 12/19/06, Lucas Holland wrote: > > Lucas Holland wrote: > > Hi! > > > > The following code: > > > > name = gets.comp.to_s > > if name == "Bill" or name == "Steve" > > puts "Wow, you're pretty smart!" > > end > > > > yields this error, once executed: > > > > NoMethodError: undefined method 'comp' for "Bill":String > > > > What is wrong with the code? > > > > Thanks in advance, > > > > chell > > > I've found the problem. Apparently, you can't explicitly convert > gets.chomp to a string (it is a string anyways, eh?), so name = > gets.chomp will do fine! Um sure you can. Its pointless but you can. Your problem was, as many other people pointed out, that you mispelled "chomp" as "comp". chell > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_12546_25953392.1166554435840--