Skip to content

Instantly share code, notes, and snippets.

@brainopia
Created April 11, 2011 09:59
Show Gist options
  • Select an option

  • Save brainopia/913306 to your computer and use it in GitHub Desktop.

Select an option

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