From: viswesh Date: 2006-05-18T21:46:23+09:00 Subject: Re: Please answer to this code? Hi Mike, Thanks for ur time. my intent of doing working on this code is : as u can see the name prints if u give the name then after that if the user types "good" or "ok" or "fine" or "wonderfull" he should be prompted with saying Good buddy. else with "oh iam sorry".. ***irrespective of case(i.e either uppercase or lowercase). i heard abt the casecmp() but usage of it 's not clear to me.. it would be great if u could use that method in this code. thanx in advance.. Mike Nelson wrote: > viswesh wrote: >> can u suggest me how to write a method where both cases are accepted to >> a given string and that method i want to refer in the below program... > > I'm not too sure what you are asking for. Something like this? > > puts " what is your name" > name = gets.chomp > > def checkIfGood(string) > if string == "good" > " good buddy" > else > "oh iam sorry" > end > end > > puts " hello #{name} how are you" > puts checkIfGood(gets.chomp) -- Posted via http://www.ruby-forum.com/.