Read input from console in Ruby? -


i want write simple a+b program in ruby, have no idea how work console.

are talking gets?

puts "enter a" = gets.chomp puts "enter b" b = gets.chomp c = a.to_i + b.to_i puts c 

something that?

update

kernel.gets tries read params found in argv , asks console if not argv found. force read console if argv not empty use stdin.gets


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -