Last active
October 17, 2015 09:44
-
-
Save mukolweke/1165d1087f9b3f8f9dcb to your computer and use it in GitHub Desktop.
Ruby
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
answer = "kuku" | |
tries = 0 | |
while tries <3 | |
print("What's my nickname? ") | |
response=gets | |
response=response.chomp | |
tries += 1 | |
if response == "kuku" | |
puts "That's right!!!" | |
exit | |
elsif tries ==3 | |
puts "Sorry, The answer is kuku" | |
exit | |
else | |
puts "Sorry, try again. " | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
want like a loop version with an array..rubitians help