Mega Code Archive

 
Categories / Ruby / Development
 

Get users input and process it, ignoring comments and exiting when the user enters the word quit

while line=gets.chomp do  # Loop, asking the user for input each time   case line   when /^\s*#/                   next                   when /^quit$/i               break                    else                         puts line.reverse        end end