title: Looping through a case statement in Ruby?
body: <p>I am trying to determine the best way to loop through a <code>case</code> statement until a user provides a certain input (in this case, <code>exit</code>). </p>
  
  <p>So far, my code works with a <code>while</code> loop, but it seems a little redundant when I have <code>input = gets.chomp</code> over and over.</p>
  
  <p>Here's a bit of abbreviated code:</p>
  
  <pre><code>input = gets.chomp
  
  while input.downcase != 'exit'
    case input.downcase
      when 'help'
        puts "Available commands are..."
        input = gets.chomp
  
      #more when statements go here...
  
      else 
        puts "That is not a valid command. Type 'HELP' for available commands."
        input = gets.chomp
    end
  end
  
  puts "Goodbye!"
  </code></pre>