Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment