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# - SharpSVN - How to get the previous revision? -

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

url - Querystring manipulation of email Address in PHP -