| (Vertical Line) is ASCII code point 124 (0x7C), Unicode U+007C, and a printable punctuation character. It draws a straight vertical stroke — a clean, upright divider that in prose occasionally separates alternatives in linguistic notation or stands between items in a table, though most people outside programming rarely type it. Code gives the pipe character relentless employment. In Unix shells, it chains commands together: cat file | grep "error" | wc -l sends each program's output into the next program's input, a compositional elegance that defines the Unix philosophy. C-family languages use | for bitwise OR and || for logical OR with short-circuit evaluation. JavaScript and Python recently adopted | for additional duties — JavaScript's pipeline proposal and Python's type union syntax (int | str in type hints) both lean on it. CSS uses it in selectors for attribute matching, and regular expressions treat | as alternation: cat|dog matches either word. The trap is a shell classic: in a pipeline, each command runs in a subshell, so variable assignments inside a piped while read loop vanish when the loop ends. Developers set a variable confidently inside the loop, use it afterward, and find it empty — the pipe created an invisible boundary that swallowed their state. The vertical bar's computing origins trace to Bob Bemer's ASCII work in the 1960s, where it was included partly to support logical OR notation in early programming languages. UTF-8 encodes it as a single byte 0x7C. Unicode classifies it as Sm (Symbol, Math) with the name VERTICAL LINE. The broken bar ¦ (U+00A6) is its fractured sibling — once common on European keyboards and occasionally still aliased to the same physical key, producing mysterious syntax errors when it lands in a shell script instead of the solid pipe the parser expects.
unsigned flags = 0x02 | 0x08; // combine bit flagsif (flags & 0x08) flags |= 0x01; // set an additional bitunsigned masked = flags | 0x80; // force high bit on
The | (pipe) sends one command's output as input to the next: ls | grep '.txt' | sort. Doug McIlroy proposed it in 1973, and it became Unix's defining feature. Pipes enable composing simple tools into powerful processing chains without intermediate files.
| is the bitwise OR operator (5 | 3 = 7, binary: 101 | 011 = 111). || is the logical OR with short-circuit evaluation — if the left side is true, the right side isn't evaluated. In shells, || runs the second command only if the first fails (to set defaults).
| creates union types: string | number means 'either a string or a number.' It's TypeScript's way of expressing alternatives. Combined with type narrowing (if/typeof checks), union types enable type-safe handling of multiple possible values without resorting to 'any.'
| means 'or' (alternation): cat|dog matches either 'cat' or 'dog.' It has the lowest precedence in regex, so abc|def matches 'abc' OR 'def', not 'ab(c|d)ef.' Use parentheses for more precise alternation: (cat|dog) food matches 'cat food' or 'dog food.'