Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Ruby command line arguments ARGV

  • ARGV

We already saw how to use

puts ARGV
puts "------"

puts ARGV[0]
puts ARGV[1]

puts "------"

ARGV.each do|a|
  puts "Argument: #{a}"
end

$ ruby examples/intro/cli.rb a b d

a
b
d
------
a
b
------
Argument: a
Argument: b
Argument: d