Getting user input

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
name = raw_input('Hi.  What's your name? ')

print name

print 'Hi, ' + name

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图