-
-
Save clark-teeple/20f4fd55204c1fbfde3e 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
#I had a 24 line version, but the assignment seems to request more than one method. | |
go = true | |
while go | |
#could be a method, but really no need to | |
#since it always has to happen | |
puts "> " | |
speak = gets.chomp.downcase | |
#had this in the main method, but this works too | |
def continue(speak) | |
if speak == "go away" | |
go = false | |
else | |
go = true | |
end | |
return go | |
end | |
#party | |
def shakil_the_dog(speak) | |
response = nil | |
if speak == "woof" | |
response = "WOOF WOOF WOOF" | |
elsif speak == "shakil stop" | |
response = " " | |
elsif speak == "meow" | |
response = "woof woof woof woof woof" | |
elsif speak.include? "treat" | |
response = "............." | |
else | |
response = "*Shakil does not understand*" | |
end | |
puts response | |
end | |
#done? | |
go = continue(speak) | |
#nope! | |
if go == true | |
shakil_the_dog(speak) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment