By clockworkpc
Closed to
I want the first condition to be satisfied when the user input includes both strings, "sudo" and "sandwich", but at the moment it is satisfied by "sandwich" only. ` def sandwich_selection(user_selection) @choice = false case user_selection when /sudo/ && /sandwich/ puts "The robot happily complies and makes you a sandwich." @status = "success" return @status @choice = true when /give up/ puts "No problem, you're welcome to try again." @status = "failure" return @status @choice = true else puts "Sorry, I can't make you a sandwich, you do not have super-user authority. You can ask again or give up." @status = "try_again" return @status end end `
Labeled:
January 22, 2017 at 07:27PM
via GitHub http://ift.tt/2iZXB5Z
No comments:
Post a Comment