ex18
This commit is contained in:
parent
8c167a01e5
commit
bb7392a440
25
ex18.rb
Normal file
25
ex18.rb
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# this one is like your scripts with argv
|
||||||
|
def puts_two(*args)
|
||||||
|
arg1, arg2 = args
|
||||||
|
puts "arg1: #{arg1}, arg2: #{arg2}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# ok, that *args is actually pointless, we can just do this
|
||||||
|
def puts_two_again(arg1, arg2)
|
||||||
|
puts "arg1: #{arg1}, arg2: #{arg2}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# this just takes one argument
|
||||||
|
def puts_one(arg1)
|
||||||
|
puts "arg1: #{arg1}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# this one takes no arguments
|
||||||
|
def puts_none()
|
||||||
|
puts "I got nothin'."
|
||||||
|
end
|
||||||
|
|
||||||
|
puts_two("Zed", "Shaw")
|
||||||
|
puts_two_again("Zed", "Shaw")
|
||||||
|
puts_one("First!")
|
||||||
|
puts_none()
|
Loading…
Reference in New Issue
Block a user