Skip to content

Instantly share code, notes, and snippets.

@backus
Created July 21, 2016 23:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
What is falsey in multiple assignment?
'truthy' if (a, b = []) # => "truthy"
'truthy' if (a, b = nil) # => nil
'truthy' if (a, b = [nil]) # => "truthy"
'truthy' if (a, b = [nil, nil]) # => "truthy"
'truthy' if (a, b = [false]) # => "truthy"
'truthy' if (a, b = [false, false]) # => "truthy"
'truthy' if (a, b = [true, false]) # => "truthy"
'truthy' if (a, b = [false, true]) # => "truthy"
'truthy' if (a, b = *[]) # => "truthy"
'truthy' if (a, b = *nil) # => "truthy"
'truthy' if (a, b = *[nil]) # => "truthy"
'truthy' if (a, b = *[nil, nil]) # => "truthy"
'truthy' if (a, b = *[false]) # => "truthy"
'truthy' if (a, b = *[false, false]) # => "truthy"
'truthy' if (a, b = *[true, false]) # => "truthy"
'truthy' if (a, b = *[false, true]) # => "truthy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment