Command line arguments - ARGV
-
ARGV
-
ARGV is an Array of Strings.
Array(String)
puts ARGV
puts ARGV.size
ARGV.each_with_index { |arg, ix|
puts "Argument #{ix} was #{arg}"
}
if ARGV.size > 0
puts ARGV[0]
end
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
ARGV
ARGV is an Array of Strings. Array(String)
puts ARGV
puts ARGV.size
ARGV.each_with_index { |arg, ix|
puts "Argument #{ix} was #{arg}"
}
if ARGV.size > 0
puts ARGV[0]
end