||=
will set the left-hand value to the right hand value only if the left-hand value is falsey.
In this case, both 6 and 4 are truthy, so a = 6 || 4
will set a
to the first truthy value, which is 6
.
a ||= 6
will set a
to 6 only if a
is falsey. That is, if it's nil or false.
a = nil
a ||= 6
a ||= 4
a # => 6