-
-
Save anonymous/c70e92a3d9458ac9d8980ec74e4e5178 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
def quiz (questions, i = 0, score = 0) | |
puts questions[i][0] | |
input = gets.chomp.downcase | |
if (i >= questions.length) | |
puts "End of quiz, you scored " + score.to_s | |
return | |
end | |
if (input == questions[i][1]) | |
puts "correct answer!" | |
score = score + 1 | |
else | |
puts "wrong answer!" | |
end | |
quiz questions i+1 score | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment