All right, I have the programming aptitude of a goldfish, so I could use some help. I have the following code (please excuse my terrible sense of humor):
puts 'Do you have a middle name?'
answer=gets.chomp.downcase
while true
if answer != ('yes' || 'no')
puts 'Yes or no answers only, dumbass.'
puts 'So I\'ll ask again. Do you have a middle name?'
answer=gets.chomp.downcase
elsif answer == ('yes' || 'no')
if answer == 'yes'
puts 'Cool. What is it?'
middlename=gets.chomp
puts middlename +'? That\'s dumb.'
break
if answer == 'no'
puts 'I guess you aren\'t cool enough.'
break
end
end
end
end
puts 'Well, smell ya later.'
It works mostly fine, but I have one problem: choosing the no option. I cannot figure out how to get that to work. It will loop fine, and choosing the yes option works.
Basically, my question is: how do I create a loop with two break options?