How do You Pass Command Line Arguments in Ruby?

Command-Line Arguments:

When you run a Ruby program from the command line, you can pass in arguments. These are accessible in two different ways:

i. The array ARGV contains each of the arguments passed to the running program. Create a file called cmd_line.rb that contains the following:

puts "You gave #{ARGV.size} arguments"

When we run it with arguments, we can see that they get passed in:

$ ruby cmd_line.rb ant bee cat dog

You gave 4 arguments

["ant", "bee", "cat", "dog"]