Skip to content

Instantly share code, notes, and snippets.

@QuillyT
Created October 20, 2015 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuillyT/baa7a91c7870f430c2fe to your computer and use it in GitHub Desktop.
Save QuillyT/baa7a91c7870f430c2fe to your computer and use it in GitHub Desktop.
Playing with console arguments# This is going to show you what the ARGV values do variable = ARGV p variable puts ARGV[0] puts ARGV[1] puts ARGV[2] thing = (ARGV[7] == nil) puts thing.inspect
# This is going to show you what the ARGV values do
#
# Just try some of these in console to see what happens:
# $ ruby argv.rb 1
# $ ruby argv.rb 1 2
# $ ruby argv.rb hi hello
# $ ruby argv.rb 1 hi message.txt
variable = ARGV
p variable
puts ARGV[0]
puts ARGV[1]
puts ARGV[2]
thing = (ARGV[7] == nil)
puts thing.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment