Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
x = method_that_returned_nil() #=> nil
x ||= "default" #=> "default" : value of x is nil, so it will be replaced with "default"
x ||= "other" #=> "default" : value of x is "default" so it will stay "default" and NOT be set to "other"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment