in reply to Re^6: 'xor' operator is not a sibling to 'or' and 'and'?
in thread 'xor' operator is not a sibling to 'or' and 'and'?
Stop thinking in terms of bitwise; this is Boolean. The "evaluated expressions" are logical values. 2 is logic-true, 3 is logic-true, 2 and 3 returns 3, which is logic-true. It uses the last evaluated expression as the logical value.
C:\usr\local\share\PassThru\perl>perl -le "print +('george' and 'graci +e')" gracie C:\usr\local\share\PassThru\perl>perl -le "print +('0' and 'gracie')" 0 C:\usr\local\share\PassThru\perl>perl -le "print +('' and 'gracie')" C:\usr\local\share\PassThru\perl>perl -le "print +('george' and 'false +')" false C:\usr\local\share\PassThru\perl>perl -le "print +('george' and '')" C:\usr\local\share\PassThru\perl>perl -le "print +(2 and 4)" 4 C:\usr\local\share\PassThru\perl>perl -le "print +(2 && 4)" 4 C:\usr\local\share\PassThru\perl>perl -le "print +(2 & 4)" 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: 'xor' operator is not a sibling to 'or' and 'and'?
by rsFalse (Chaplain) on Dec 18, 2019 at 23:13 UTC | |
by pryrt (Abbot) on Dec 19, 2019 at 14:08 UTC |