Created
October 20, 2015 00:49
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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