Created
November 9, 2017 18:39
-
-
Save Dasms/dc724712d2be4b03f150b97ad2da5e41 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 one is just like your scripts with ARGV | |
def print_two(*args) | |
arg1, arg2 = args | |
puts "arg1: #{arg1}, arg2: #{arg2}" | |
end | |
# That *args is actually pointless, we can just do this: | |
def print_two_again(arg1, arg2) | |
puts "arg1: #{arg1}, arg2: #{arg2}" | |
end | |
# Just 1 argument | |
def print_one(arg1) | |
puts "arg1: #{arg1}" | |
end | |
# No arguments | |
def print_none | |
puts "I got nothin'." | |
end | |
print_two("Idaho","Potato") | |
print_two_again("Idaho","Potato") | |
print_one("First!") | |
print_none() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment