Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ask question
- goodAnswer = false
- while (not goodAnswer)
- puts question
- reply = gets.chomp.downcase
- if (reply == 'yes' or reply == 'no')
- goodAnswer = true
- if reply == 'yes'
- answer = true
- else
- answer = false
- end
- else
- puts 'Please answer "yes" or "no".'
- end
- end
- answer # This is what we return (true or false).
- end
- puts 'Hello, and thank you for...'
- puts
- ask 'Do you like eating tacos?' # We ignore this return value.
- ask 'Do you like eating burritos?'
- wetsBed = ask 'Do you wet the bed?' # We save this return value.
- ask 'Do you like eating chimichangas?'
- ask 'Do you like eating sopapillas?'
- ask 'Do you like eating tamales?'
- puts 'Just a few more questions...'
- ask 'Do you like drinking horchata?'
- ask 'Do you like eating flautas?'
- puts
- puts 'DEBRIEFING:'
- puts 'Thank you for...'
- puts
- puts wetsBed
Advertisement
Add Comment
Please, Sign In to add comment