From: Daniel N Date: 2006-05-17T23:00:24+09:00 Subject: Re: Please answer to this code? ------=_Part_99100_33456783.1147874420856 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline viswesh, The place where your having the error is if fine.String =3D=3D "good" fine is already a string, thats what gets returns so you don't need to convert it. String is a class not a method, so object.String will not work. If you wan= t to get a string from an object use the to_s method eg object.to_s but you could do this a bit differently puts "What is your name?" puts "Hello #{gets.chomp} how are you?" fine =3D gets.chomp fine =3D=3D "good" ? puts( "Good buddy") : puts( "Oh I'm Sorry" ) This would do the same thing that your looking to do with the code above, but would be more convienient if you wrapped it in a method definition and then called it. def check_it_out puts "What is your name?" puts "Hello #{gets.chomp} how are you?" fine =3D gets.chomp fine =3D=3D "good" ? puts( "Good buddy") : puts( "Oh I'm Sorry" ) end call with check_it_out On 5/17/06, viswesh wrote: > > can anybody execute it and tell me where i go wrong.please let me know > asap... > > > puts " what is your name" > name =3D gets.chomp > > puts " hello " + name + " how are you" > > fine =3D gets > > if fine.String=3D=3D"good" > puts " good buddy" > else > puts "oh iam sorry" > end > > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_99100_33456783.1147874420856--