Y
Hacker News
new
|
ask
|
show
|
jobs
by
goldbrick
3695 days ago
Why not just make the argument default to 16? Is something non-obvious going on?
1 comments
infraruby
3695 days ago
The caller may pass nil explicitly.
link
goldbrick
3695 days ago
I don't understand. You may still pass nil explicitly if the argument defaults to 16?
link
infraruby
3695 days ago
Yes:
def f(n = 16) n end p f # => 16 p f(nil) # => nil
link