Ruby places parameters that are appended to the command line into a special array called ARGV. : ARGV « Development « Ruby






Ruby places parameters that are appended to the command line into a special array called ARGV.


puts ARGV.join('-')

# From the command prompt, run the script like so:

ruby argv.rb

# The result will be blank, but then try to run it like so:

ruby argv.rb test 123

 








Related examples in the same category

1.The two filenames are both command line arguments
2.Assign value to ARGV
3.Get command line input through ARGV