It's like the Null Coalescing Operator from PHP : php.net/manual/en/language.operato...
A common misconception is that a ||= b is equivalent to a = a || b, but it behaves like a || a = b
Here's a link explaining in Ruby : rubyinside.com/what-rubys-double-p...
Stop liking my comment ! It's false, it's not a Null coalescing.
Ruby : a || = b
PHP equivalent : $a = $a != null ? $a : $b;
Or in "pseudocode" : If 'a' is not null 'a' is equal to 'a' (itself) else 'a' is equal to 'b'
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's like the Null Coalescing Operator from PHP : php.net/manual/en/language.operato...
A common misconception is that a ||= b is equivalent to a = a || b, but it behaves like a || a = b
Here's a link explaining in Ruby : rubyinside.com/what-rubys-double-p...
Stop liking my comment !
It's false, it's not a Null coalescing.
Ruby :
a || = b
PHP equivalent :
$a = $a != null ? $a : $b;
Or in "pseudocode" :
If 'a' is not null
'a' is equal to 'a' (itself)
else
'a' is equal to 'b'