fork download
  1. def ask_recursively question
  2. puts question
  3. reply = gets.chomp.downcase
  4.  
  5. if reply == 'yes'
  6. true
  7. elsif reply == 'no'
  8. false
  9. else
  10. puts 'Please answer "yes" or "no".'
  11. ask_recursively question
  12. end
  13. end
  14.  
  15. ask_recursively 'Do you wet the bed?'
  16.  
Runtime error #stdin #stdout 0.02s 7408KB
stdin
Standard input is empty
stdout
Do you wet the bed?