'nil'
to arg2
?def mymethod(arg1, arg2='default')Well, (as expected?) if you pass a nil as an argument, then there is something being passed, and hence
arg2
end
'default'
won't be passed:mymethod('foo', nil) #=> nilAnd if you passed it just a single argument, here's what it'll look like:
mymethod('foo') #=> 'default'
0 comments:
Post a Comment