A simple Q and A quiz that reinforces Ruby learning
Store related data in a Hash

Also, looping like you've done is very uncommon in Ruby. You'll see Array#each (or Hash#each in this case) much more common than storing an index in a var while iterating through indexes.

@success_msg = 'Good job. Next question..'
@incorrect_msg = 'Incorrect. Next question..'
{
  "What is the command for a 'for' loop?" =&gt; 'for',
  'What is another name for a method?' =&gt; 'function',
  'What are the three types of loops that I know of?' =&gt; 'while, for, and until'
}.each do |q, a|
  puts q
  puts(gets.chomp.downcase == a ? @success_msg : @incorrect_msg)
end
puts 'All done.'


Also, I'd try to make this multiple choice or something if you're really trying to use it, theres no way your response is going to match those answers exactly. Perhaps you could look for certain terms in the response, but parsing English for semantic meaning isn't very easy hehe.