It's about operations order.
Nil doesn't have a boolean value.
In && statement it returns false when at least on argument is false.
So in the expression:
false && nil
it is discovering that the first argument is false and there is pointless to check the second one, so it returned false.
In second case - nil && false
it encounters nil, so the value which cannot be compare with boolean, in consequence the expression cannot be evaluated, so it returns 'nil', like in every other similar case in ruby.
In '||' statement it gives false where first or second argument is false.
1st case: false || nil
- it checks that first argument is false and then verifies second one which actually is nothing, so that it gives first value.
2nd case nil || false
it checks first is nothing, then second which is boolean so it returns false.