From: Justin Collins Date: 2009-02-20T05:04:39+09:00 Subject: Re: ASCII Menu in Ruby, is it possible? Ruby Student wrote: > Hello Team, > > Is there a way in Ruby to create primitive ASCII menus? > At this point I am shying away from GUI as everything outthere, in the GUI > world is too.... > I just want to know if I can create simple menus of the type: > > 1 - Enter 1 and press Enter to continue > 2 - Enter 2 or X and press Enter to exit > 3 - Etc. > > Thank you > > Sure you can. For example: def menu loop do puts "1. Do something", "2. Do something else", "3. Nevermind" input = gets.strip case input when "1" puts "Did something" when "2" puts "Did something else" when "3" puts "Bye!" return else puts "Invalid option: #{input}" end end end menu -Justin