||= will set the left value to the right value only if the left value is false.
In this case, both 6 and 4 are true, therefore a = 6 || 4 a = 6 || 4 sets a to the first truth value, which is 6 .
a ||= 6 set a to 6 only if a false. That is, if it is zero or false.
a = nil a ||= 6 a ||= 4 a
source share