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
Post a Comment