i am having trouble with if statements.
i want the program to check if the answer is yes or no then do the
process related to the answer but i cannot do it
any help ?
i am having trouble with if statements.
i want the program to check if the answer is yes or no then do the
process related to the answer but i cannot do it
any help ?
On Sat, Jan 29, 2011 at 8:38 PM, Dan L. [email protected]
wrote:
i am having trouble with if statements.
i want the program to check if the answer is yes or no then do the
process related to the answer but i cannot do itany help ?
–
Posted via http://www.ruby-forum.com/.
if answer == ‘yes’
elsif answer == ‘no’
else
end
thanks 
On Sun, Jan 30, 2011 at 5:57 AM, Dan L. [email protected]
wrote:
thanks
Here’s an alternative way using case statement that I personally find
nicer:
case answer
when “yes”
when “no”
else
$stderr.puts “Wrong answer: #{answer}”
end
Cheers
robert
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs