-
-
Save videlais/9ddaf28bee30177eb71b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parser | |
def initalize() | |
end | |
public | |
def parse(input) | |
case input | |
when "Dan" | |
good_response | |
else | |
bad_response | |
end | |
end | |
private | |
def good_response | |
puts "Looks like your name is Dan. Neat!" | |
end | |
def bad_response | |
puts "You are not a Dan!" | |
end | |
end | |
parser = Parser.new | |
loop do | |
puts "Enter your name:" | |
input = gets.chomp | |
break if input == "quit" | |
parser.parse(input) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment