The difference is that | (single pipe) bitwise and and || (dual channel) logical or || is a logical OR operator. It looks like you basically know what it is. It is used in conditional statements such as if, while, etc.
condition1 || condition2
"||" will check the sequence starting from the first. If any condition in the sequence is true, then || stops further verification. more efficient in conditional statements
| is a bitwise OR operator. It was used for two numbers. You look at each bit of each number separately, and if one of the bits is 1, at least one of the numbers, then the resulting bit will be 1. Here are a few examples:
A = 01010101 B = 10101010 A | B = 11111111 A = 00000001 B = 00010000 A | B = 00010001
source share