Skip to content

Instantly share code, notes, and snippets.

@brainopia
Created April 11, 2011 09:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainopia/913306 to your computer and use it in GitHub Desktop.
Save brainopia/913306 to your computer and use it in GitHub Desktop.
def method(variable=((default=true);nil))
puts "Value: #{variable.inspect}, default argument - #{!!default}"
end
method nil # => Value: nil, default argument - false
method # => Value: nil, default argument - true
@keltia
Copy link

keltia commented Apr 11, 2011

That's an interesting answer but IMHO unnecessarily complex...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment