Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
goldbrick
· 10y ago · 0 comments
Why not just make the argument default to 16? Is something non-obvious going on?
Comments
[–]
infraruby
10y ago
The caller may pass nil explicitly.
[–]
goldbrick
OP
10y ago
I don't understand. You may still pass nil explicitly if the argument defaults to 16?
[–]
infraruby
10y ago
Yes:
def f(n = 16) n end p f # => 16 p f(nil) # => nil