Hubbry Logo
Vertical barVertical barMain
Open search
Vertical bar
Community hub
Vertical bar
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Vertical bar
Vertical bar
from Wikipedia
|
Vertical bar
In UnicodeU+007C | VERTICAL LINE (|, |, |)
Related
See alsoU+00A6 ¦ BROKEN BAR (¦)

U+2016 DOUBLE VERTICAL LINE (‖, ‖)

U+2223 DIVIDES

The vertical bar, |, is a glyph with various uses in mathematics, computing, and typography. It has many names, often related to particular meanings: Sheffer stroke (in logic), pipe, bar, or (literally, the word "or"), vbar, and others.[1]

Usage

[edit]

Mathematics

[edit]

The vertical bar is used as a mathematical symbol in numerous ways. If used as a pair of brackets, it suggests the notion of the word "size". These are:

  • absolute value: , read "the absolute value of x"[2]
  • cardinality: , read "the cardinality of the set S" or "the length of a string S"
  • determinant: , read "the determinant of the matrix A".[2] When the matrix entries are written out, the determinant is denoted by surrounding the matrix entries by vertical bars instead of the usual brackets or parentheses of the matrix, as in .
  • order: , read "the order of the group G", or , "the order of the element "

Likewise, the vertical bar is also used singly in many different ways:

  • conditional probability: , read "the probability of X given Y"
  • distance: , denoting the shortest distance between point to line , so line is perpendicular to line
  • divisibility: , read "a divides b" or "a is a factor of b", though Unicode also provides special 'divides' and 'does not divide' symbols (U+2223 DIVIDES and U+2224 DOES NOT DIVIDE)[2]
  • function evaluation: , read "f of x, evaluated at x equals 4" (see subscripts at Wikibooks)
  • restriction: , denoting the restriction of the function , with a domain that is a superset of , to just
  • set-builder notation: , read "the set of x such that x is less than two". Often, a colon ':' is used instead of a vertical bar
  • the Sheffer stroke in logic: , read "a nand b"
  • subtraction: , read "f(x) from a to b", denoting . Used in the context of a definite integral with variable x.
  • A vertical bar can be used to separate variables from fixed parameters in a function, for example , or in the notation for elliptic integrals.

The double vertical bar, , is also employed in mathematics.

  • parallelism: , read "the line is parallel to the line "
  • norm: , read "the norm (length, size, magnitude etc.) of the matrix ". The norm of a one-dimensional vector is the absolute value and single bars are used.[3]
  • Propositional truncation: (a type former that truncates a type down to a mere proposition in homotopy type theory): for any (read "term of type ") we have [4] (here reads "image of in " and reads "propositional truncation of ")[5]

In LaTeX mathematical mode, the ASCII vertical bar produces a vertical line, and \| creates a double vertical line (a | b \| c is set as ). This has different spacing from \mid and \parallel, which are relational operators: a \mid b \parallel c is set as . See below about LaTeX in text mode.

Chemistry

[edit]

In chemistry, the vertical line is used in cell notation of electrochemical cells.

Example,

Zn | Zn2+ || Cu2+ | Cu

Single vertical lines show components of the cell which do not mix, usually being in different phases. The double vertical line ( || ) is used to represent salt bridge; which is used to allow free moving ions to move.

Physics

[edit]

The vertical bar is used in bra–ket notation in quantum physics. Examples:

  • : the quantum physical state
  • : the dual state corresponding to the state above
  • : the inner product of states and
  • Supergroups in physics are denoted G(N|M), which reads "G, M vertical bar N"; here G denotes any supergroup, M denotes the bosonic dimensions, and N denotes the Grassmann dimensions.[6]

Computing

[edit]

Pipe

[edit]

A pipe is an inter-process communication mechanism originating in Unix, which directs the output (standard out and, optionally, standard error) of one process to the input (standard in) of another. In this way, a series of commands can be "piped" together, giving users the ability to quickly perform complex multi-stage processing from the command line or as part of a Unix shell script ("bash file"). In most Unix shells (command interpreters), this is represented by the vertical bar character. For example:

grep -i 'blair' filename.log | more

where the output from the grep process (all lines containing 'blair') is piped to the more process (which allows a command line user to read through results one page at a time).

The same "pipe" feature has been borrowed for use in other operating systems.

This usage has led to the character itself being called "pipe".

Disjunction

[edit]

In many programming languages, the vertical bar is used to designate the logic operation or, either bitwise or or logical or.

Specifically, in C and other languages following C syntax conventions, such as C++, Perl, Java and C#, a | b denotes a bitwise or; whereas a double vertical bar a || b denotes a (short-circuited) logical or. Since the character was originally not available in all code pages and keyboard layouts, ANSI C can transcribe it in form of the trigraph ??!, which, outside string literals, is equivalent to the | character.

In regular expression syntax, the vertical bar again indicates logical or (alternation). For example: the Unix command grep -E 'fu|bar' matches lines containing 'fu' or 'bar'.

Concatenation

[edit]

The double vertical bar operator "||" denotes string concatenation in PL/I, REXX, ooRexx, standard ANSI SQL, and theoretical computer science (particularly cryptography).

Delimiter

[edit]

Although not as common as commas or tabs, the vertical bar can be used as a delimiter in a flat file. Examples of a pipe-delimited standard data format are LEDES 1998B and HL7. It is frequently used because vertical bars are typically uncommon in the data itself.

Similarly, the vertical bar may see use as a delimiter for regular expression operations (e.g. in sed). This is useful when the regular expression contains instances of the more common forward slash (/) delimiter; using a vertical bar eliminates the need to escape all instances of the forward slash. However, this makes the bar unusable as the regular expression "alternative" operator.

Backus–Naur form

[edit]

In Backus–Naur form, an expression consists of sequences of symbols and/or sequences separated by '|', indicating a choice, the whole being a possible substitution for the symbol on the left.

<personal-name> ::= <name> | <initial>

Concurrency operator

[edit]

In calculi of communicating processes (like pi-calculus), the vertical bar is used to indicate that processes execute in parallel.

APL

[edit]

The pipe in APL is the modulo or residue function between two operands and the absolute value function next to one operand.

List comprehensions

[edit]

The vertical bar is used for list comprehensions in some functional languages, e.g. Haskell and Erlang. Compare set-builder notation.

Text markup

[edit]

The vertical bar is used as a special character in lightweight markup languages, notably MediaWiki's Wikitext (in the templates and internal links).

In LaTeX text mode, the vertical bar produces an em dash (—). The \textbar command can be used to produce a vertical bar.

Phonetics and orthography

[edit]

In the Khoisan languages and the International Phonetic Alphabet, the vertical bar is used to write the dental click (ǀ). A double vertical bar is used to write the alveolar lateral click (ǁ). Since these are technically letters, they have their own Unicode code points in the Latin Extended-B range: U+01C0 ǀ LATIN LETTER DENTAL CLICK and U+01C1 ǁ LATIN LETTER LATERAL CLICK.

Some Northwest and Northeast Caucasian languages written in the Cyrillic script have a vertical bar called palochka (Russian: палочка, lit.'little stick'), indicating the preceding consonant is an ejective.

Longer single and double vertical bars are used to mark prosodic boundaries in the IPA.

Literature

[edit]

In medieval European manuscripts, a single vertical bar was a common variant of the virgula / used as a comma,[7] or caesura mark.[7]

In Sanskrit and other Indian languages, a single vertical mark, ।, called a danda, has a similar function as a period (full stop). Two bars, ॥, (a 'double danda') is the equivalent of a pilcrow in marking the end of a stanza, paragraph or section. The danda has its own Unicode code point, U+0964 DEVANAGARI DANDA; as does the double danda: U+0965 DEVANAGARI DOUBLE DANDA.

Poetry

[edit]

A double vertical bar ⟨||⟩ or ⟨‖⟩[citation needed] is the standard caesura mark in English literary criticism and analysis. It marks the strong break or caesura common to many forms of poetry, particularly Old English verse. It is also traditionally used to mark the division between lines of verse printed as prose (the style preferred by Oxford University Press), though it is now often replaced by the forward slash.[citation needed]

Notation

[edit]

In the Geneva Bible and early printings of the King James Version, a double vertical bar is used to mark margin notes that contain an alternative translation from the original text. These margin notes always begin with the conjunction "Or". In later printings of the King James Version, the double vertical bar is irregularly used to mark any comment in the margins.

A double vertical bar symbol may be used to call out a footnote. (The traditional order of these symbols in English is *, , , §, ‖, , so its use is very rare; in modern usage, numbers and letters are preferred for endnotes and footnotes.[8])

Music scoring

[edit]

In music, when writing chord sheets, single vertical bars associated with a colon (|: A / / / :|) represents the beginning and end of a section (e.g. Intro, Interlude, Verse, Chorus) of music.[citation needed] Single bars can also represent the beginning and end of measures (|: A / / / | D / / / | E / / / :|). A double vertical bar associated with a colon can represent the repeat of a given section (||: A / / / :|| - play twice).[citation needed]

Broken bar

[edit]
The code point 124 (7C hexadecimal) is occupied by a broken bar in a dot matrix printer of the late 1980s, which apparently lacks a solid vertical bar. See the full picture.

Many early video terminals and dot-matrix printers rendered the vertical bar character as the allograph broken bar ¦. This may have been to distinguish the character from the lower-case 'L' and the upper-case 'I' on these limited-resolution devices, and to make a vertical line of them look more like a horizontal line of dashes. It was also (briefly) part of the ASCII standard.

An initial draft for a 7-bit character set that was published by the X3.2 subcommittee for Coded Character Sets and Data Format on June 8, 1961, was the first to include the vertical bar in a standard set. The bar was intended to be used as the representation for the logical OR symbol.[9] A subsequent draft on May 12, 1966, places the vertical bar in column 7 alongside regional entry codepoints, and formed the basis for the original draft proposal used by the International Standards Organisation.[9] This draft received opposition from the IBM user group SHARE, with its chairman, H. W. Nelson, writing a letter to the American Standards Association titled "The Proposed revised American Standard Code for Information Interchange does NOT meet the needs of computer programmers!"; in this letter, he argues that no characters within the international subset designated at columns 2-5 of the character set would be able to adequately represent logical OR and logical NOT in languages such as IBM's PL/I universally on all platforms.[10] As a compromise, a requirement was introduced where the exclamation mark (!) and circumflex (^) would display as logical OR (|) and logical NOT (¬) respectively in use cases such as programming, while outside of these use cases they would represent their original typographic symbols:

"It may be desirable to employ distinctive styling to facilitate their use for specific purposes as, for example, to stylize the graphics in code positions 2/1 and 5/14 to those frequently associated with logical OR (|) and logical NOT (¬) respectively."

— X3.2 document X3.2/475[11]

The original vertical bar encoded at 0x7C in the original May 12, 1966 draft was then broken as ¦, so it could not be confused with the unbroken logical OR. In the 1967 revision of ASCII, along with the equivalent ISO 464 code published the same year, the code point was defined to be a broken vertical bar, and the exclamation mark character was allowed to be rendered as a solid vertical bar.[12][13] However, the 1977 revision (ANSI X.3-1977) undid the changes made in the 1967 revision, enforcing that the circumflex could no longer be stylised as a logical NOT symbol, the exclamation mark likewise no longer allowing stylisation as a vertical bar, and defining the code point originally set to the broken bar as a solid vertical bar instead;[12] the same changes were also reverted in ISO 646-1973 published four years prior.

Some variants of EBCDIC included both versions of the character as different code points. The broad implementation of the extended ASCII ISO/IEC 8859 series in the 1990s also made a distinction between the two forms. This was preserved in Unicode as a separate character at U+00A6 ¦ BROKEN BAR (the term "parted rule" is used sometimes in Unicode documentation). Some fonts draw the characters the same (both are solid vertical bars, or both are broken vertical bars).[14][failed verification]

The broken bar does not appear to have any clearly identified uses distinct from those of the vertical bar.[15] In non-computing use — for example in mathematics, physics and general typography — the broken bar is not an acceptable substitute for the vertical bar. In some dictionaries, the broken bar is used to mark stress that may be either primary or secondary: [¦ba] covers the pronunciations [ˈba] and [ˌba].[16]

Unicode

[edit]
  • U+007C | VERTICAL LINE (&verbar;, &vert;, &VerticalLine;) (single vertical line)
  • U+00A6 ¦ BROKEN BAR (&brvbar;) (single broken line)
  • U+2016 DOUBLE VERTICAL LINE (&Verbar;, &Vert;) (double vertical line ( ): used in pairs to indicate norm)
  • U+FF5C FULLWIDTH VERTICAL LINE (Fullwidth form)
  • U+FFE4 FULLWIDTH BROKEN BAR
  • U+2225 PARALLEL TO (&DoubleVerticalBar;, &par;, &parallel;, &shortparallel;, &spar;)
  • U+01C0 ǀ LATIN LETTER DENTAL CLICK
  • U+01C1 ǁ LATIN LETTER LATERAL CLICK
  • U+2223 DIVIDES (&mid;, &shortmid;, &smid;, &VerticalBar;)
  • U+2502 BOX DRAWINGS LIGHT VERTICAL (&boxv;) (and various other box drawing characters in the range U+2500 to U+257F)
  • U+2758 LIGHT VERTICAL BAR
  • U+0964 DEVANAGARI DANDA
  • U+0965 DEVANAGARI DOUBLE DANDA

Historical encodings

[edit]
Code pages, ASCII, ISO/IEC, EBCDIC, Shift-JIS, etc. Vertical bar (|) Broken bar (¦)
ASCII,
CP437, CP667, CP720, CP737, CP790, CP819, CP852, CP855, CP860, CP861, CP862, CP865, CP866, CP867, CP869, CP872, CP895, CP932, CP991
124 (7Ch) none
CP775 167 (A7h)
CP850, CP857, CP858 221 (DDh)
CP863 160 (A0h)
CP864 219 (DBh)
ISO/IEC 8859-1, -7, -8, -9, -13,
CP1250, CP1251, CP1252, CP1253, CP1254, CP1255, CP1256, CP1257, CP1258
166 (A6h)
ISO/IEC 8859-2, -3, -4, -5, -6, -10, -11, -14, -15, -16 none
EBCDIC CCSID 37 79 (4Fh) 106 (6Ah)
EBCDIC CCSID 500 187 (BBh)
JIS X 0208, JIS X 0213 Men-ku-ten 1-01-35 (7-bit: 2143h; Shift JIS: 8162h; EUC: A1C3h)[a] none

See also

[edit]

Notes

[edit]

References

[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
The vertical bar, denoted by the glyph | (Unicode U+007C), is a straight vertical line character classified as a mathematical (Sm category) in the Standard, where it is officially named "Vertical Line." Also known by aliases such as pipe or bar, it serves as a versatile mark and operator with prominent roles in , , and , often functioning as a , separator, or indicator of logical relationships. In , the vertical bar has multiple established notations that convey precise concepts. It denotes the of a number, as in |x|, representing the magnitude without regard to sign—for instance, |-3| = 3. It appears in to mean "such that," defining elements satisfying a condition, such as {x ∈ ℝ | x > 0}, the set of all . Additionally, it indicates in statistics, as P(A|B) for the probability of A given B, and divisibility between integers, where a|b means a divides b evenly. In and programming, the vertical bar functions as the pipe operator in operating systems, redirecting the output of one command as input to another—for example, cat file.txt | wc counts the words in a file by piping its contents. It also acts as a bitwise OR operator in languages like C/C++, performing binary operations on integers, and as part of the logical OR (||) for conditional statements. In regular expressions, a single | signifies alternation, matching one pattern or another, such as a|b for "a or b." Typographically, it appears as a separator in URLs, tables, or menus to divide elements clearly.

Mathematical and scientific notation

Mathematics

In , the vertical bar denotes divisibility, where aba \mid b means that aa divides bb if there exists an kk such that b=akb = a k. This notation indicates that bb is an multiple of aa, without implying division in the arithmetic sense. For example, 242 \mid 4 holds because 4=224 = 2 \cdot 2, whereas 343 \nmid 4 since no such kk exists. The symbol was introduced in unpublished notes from G. H. Hardy's 1925 seminar and first appeared in print in Edmund Landau's 1927 book Elementary Number Theory. In , the vertical bar represents , denoted as P(AB)P(A \mid B), which is the probability that event AA occurs given that event BB has occurred, assuming P(B)>0P(B) > 0. This is defined as P(AB)=P(AB)P(B)P(A \mid B) = \frac{P(A \cap B)}{P(B)}, where P(AB)P(A \cap B) is the joint probability of both events. The formula derives from the axioms of probability in measure-theoretic terms, treating events as subsets of a ; specifically, it normalizes the measure of the intersection ABA \cap B by the measure of BB, reflecting the restriction of the to outcomes in BB. This notation, using the vertical bar for "given," became standardized in the mid-20th century following earlier variants like Kolmogorov's PB(A)P_B(A) in 1933. The vertical bars also denote the absolute value of a real number xx, written as x|x|, which gives the distance of xx from zero on the number line and is always non-negative. For x0x \geq 0, x=x|x| = x; for x<0x < 0, x=x|x| = -x. This single-bar notation, adopted widely in the 20th century, replaced earlier uses of double bars x\|x\| for magnitude in some contexts, particularly as linear algebra distinguished norms with double bars. The shift emphasized clarity in elementary contexts, as documented in historical surveys of mathematical symbols. In linear algebra, vertical bars enclose a square matrix to denote its determinant, so A=det(A)|A| = \det(A) for an n×nn \times n matrix AA. The determinant measures properties like invertibility and volume scaling under linear transformations. For a 2×2 matrix A=(abcd)A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}, the determinant is computed as A=adbc|A| = ad - bc. For instance, if A=(3124)A = \begin{pmatrix} 3 & 1 \\ 2 & 4 \end{pmatrix}, then A=(3)(4)(1)(2)=122=10|A| = (3)(4) - (1)(2) = 12 - 2 = 10. This notation traces to Arthur Cayley's 1841 work, where double vertical lines were used, evolving to single bars as the standard by the late 19th century.

Chemistry

In chemistry, the vertical bar (|) serves as a delimiter in several notations, particularly in electrochemistry and phase representations, to indicate boundaries between different phases or components. A primary application is in the cell notation for electrochemical cells, where a single vertical bar denotes a phase boundary, such as between a solid electrode and its surrounding electrolyte solution. For instance, in the Daniell cell, the notation Zn | Zn²⁺ || Cu²⁺ | Cu represents the zinc anode in contact with zinc ions (separated by |), the salt bridge (||), and the copper cathode with copper ions (separated by |). This convention allows concise depiction of the cell's structure without drawing diagrams, with components listed from left to right across the cell. The double vertical bar (||) specifically indicates the salt bridge or a liquid junction with low resistance, distinguishing it from single bars for phase interfaces. The vertical bar also represents phase boundaries in broader chemical contexts, such as solubility equilibria or multi-phase systems. According to IUPAC recommendations, a single | separates immiscible phases, like in the notation for a gas-liquid interface (e.g., H₂(g) | H₂O(l)), while a dashed vertical bar (│) denotes junctions between miscible liquids, and || indicates immiscible liquid boundaries. This usage extends to phase diagrams, where vertical lines mark transitions, such as the solid | liquid boundary in a one-component diagram, helping to visualize regions of stability for each phase under varying temperature and pressure. The vertical bar has a limited role in SMILES (Simplified Molecular Input Line Entry System) notation for organic structures, primarily in extensions for annotations or stereochemistry. For example, in some parsers like RDKit, | delimits non-standard features such as lone pair specifications (e.g., O|lp for oxygen with a lone pair tag), though core SMILES uses / and \ for double-bond configurations like in trans-but-2-ene (C/C=C/C). This usage supports advanced molecular modeling but is not part of the basic Daylight SMILES specification.

Physics

In physics, the vertical bar denotes the magnitude of physical quantities, particularly vectors, distinguishing it from the vector's directional properties. For a velocity vector v, the speed is represented as |v|, yielding a scalar value that quantifies the object's motion without direction. This usage emphasizes the non-negative length of the vector in , as seen in kinematic equations where |r| gives displacement magnitude. Unlike abstract scalar norms in higher mathematics, the single vertical bars in physics conventionally apply the Euclidean norm for three-dimensional vectors, ensuring compatibility with empirical measurements. A prominent application occurs in quantum mechanics through Dirac notation, where vertical bars define kets and contribute to bras. A quantum state is expressed as a ket |φ⟩, a column vector in , while its dual bra is ⟨ψ|, a row vector formed by the Hermitian conjugate. The inner product between states, ⟨ψ|φ⟩, computes the overlap integral, yielding a complex number whose magnitude squared gives the transition probability: ψϕ=ψ(x)ϕ(x)dx\langle \psi | \phi \rangle = \int_{-\infty}^{\infty} \psi^*(x) \, \phi(x) \, dx This notation simplifies operator applications and expectation values, such as ⟨ψ|Ĥ|ψ⟩ for energy. Paul Dirac introduced this bra-ket formalism in 1939 to streamline quantum expressions, replacing cumbersome wave function integrals with abstract vector operations while preserving physical interpretability.

Computing and programming

Pipe operator

In Unix-like operating systems, the vertical bar serves as the pipe operator |, which redirects the standard output of a command on its left as the standard input to a command on its right, enabling the chaining of multiple processes in a data stream. This mechanism, known as shell piping, was conceived by and implemented in the third edition of Unix in 1973 by , following McIlroy's advocacy for linking programs to process streams efficiently. For example, the command ls | grep "file" lists directory contents and filters for lines containing "file", demonstrating how output flows seamlessly without manual file handling. Piping supports chaining of multiple commands, as seen in Bash with expressions like cat file.txt | sort | uniq, where the contents of a file are read, sorted alphabetically, and deduplicated in a single pipeline. PowerShell adopts a similar | operator for object-oriented pipelines, allowing cmdlets to process .NET objects directly; for instance, Get-Process | Where-Object {$_.CPU -gt 100} | Stop-Process retrieves processes, filters those using over 100 CPU units, and terminates them. This streaming approach enhances performance by avoiding the creation of intermediate files, reducing disk I/O overhead compared to temporary file-based workflows, though kernel-level buffering in pipes can introduce latency for very large datasets. Beyond shells, the pipe concept extends to programming languages for function composition. In Elixir, the |> operator chains functions by passing the result of the left expression as the first argument to the right, as in String.split("hello world", " ") |> Enum.map(&String.capitalize/1), which splits a and capitalizes each word. Similarly, R's magrittr package provides the %>% operator for forwarding values through a sequence of functions, exemplified by mtcars %>% subset(cyl == 6) %>% transform(mpg = mpg * 1.1), which filters a and modifies values in a readable pipeline.

Logical disjunction

The vertical bar | is used as a symbol for in some notations, particularly in and programming languages, representing the inclusive OR operation where the compound P | Q is true if at least one of P or Q is true, and false only if both are false. This operation is fundamental to and formal reasoning systems. The for the disjunction of two propositions P and Q using | is as follows: | P | Q | P | Q | |-------|-------|-------| | True | True | True | | True | False | True | | False | True | True | | False | False | False | This table illustrates the inclusive nature of the operation, where the result is true in three out of four cases. In programming languages, the vertical bar | is employed as a logical OR operator in certain contexts, notably in , where it evaluates to true if either operand is true, as defined in the language's standard prelude for expressions. For example, in , an expression like p | q combines two values, yielding true if at least one is true. This usage was introduced in the design of , ratified in , influencing subsequent languages' adoption of vertical bar variants for disjunctive logic. In contrast, many C-like programming languages, such as C and Java, distinguish between the single vertical bar | as a bitwise OR operator—which performs bit-by-bit disjunction on integer operands—and the double vertical bar || as the logical OR operator, which evaluates boolean conditions and supports short-circuit evaluation. For instance, in C, if (a | b) applies bitwise OR to the values of a and b before the conditional check, potentially evaluating both even if the first is nonzero, whereas if (a || b) uses logical OR and skips the second operand if the first is true. This distinction ensures bitwise operations handle numerical data efficiently while logical operations prioritize boolean semantics and performance in control flow.

String concatenation

In several programming languages and database query standards, the vertical bar serves as part of the double vertical bar operator (||), which is dedicated to , joining two or more or compatible expressions into a single string by appending them sequentially. This operator originated in early languages and has been standardized for clarity and . One of the earliest uses appears in , a developed in the by for mainframe computing, where || explicitly concatenates character, bit, or graphic s, potentially triggering implicit conversions to string types if operands are not already strings. For example, the expression NAME = FIRSTNAME || ' ' || LASTNAME; produces a full name by combining variables and a literal space. Similarly, in , a introduced by in for system automation, || performs concatenation on terms such as variables, literals, or expressions, with no implicit required as all values are treated as strings by default. The || operator is also the ANSI SQL standard for string concatenation across database systems like , , and Vertica, allowing the merging of column values, literals, and constants. For instance, SELECT first_name || ' ' || last_name AS full_name FROM employees; retrieves employee records with names joined by a , handling NULL values by propagating them to produce a NULL result if any is NULL. This usage extends to other dialects, such as , where || replaces the non-standard + in some contexts for portability. A key advantage of || over the + operator—commonly used for arithmetic —is its explicit focus on strings, which mitigates type issues where mixing numeric and string operands could lead to unintended instead of . For example, in languages overloading + (like or early BASIC dialects), "1" + 2 might yield the string "12", but 1 + "2" could coerce to numeric resulting in 3, causing bugs in dynamic contexts; || enforces string handling without such ambiguity. This design choice promotes safer code in mixed-type expressions, as seen in and SQL where + remains reserved for numerics.

Delimiters and separators

In file URI schemes for Windows and DOS-derived systems, the vertical bar replaces the colon in drive letter specifications to comply with URI syntax rules, where the colon is reserved. For instance, the local path C:\Users\file.txt is represented as file:///C|/Users/file.txt. Certain APIs, especially those adhering to the OpenAPI Specification, support the pipeDelimited serialization style for query parameters, using the vertical bar to separate array or object values within a single parameter. An example is ?color=blue|black|brown, which specifies multiple color options. As an alternative to (CSV) files, pipe-delimited files—often called pipe-separated values (PSV)—use the vertical bar to separate fields, avoiding issues with comma-containing data. A typical record might appear as name|age|city, such as John Doe|30|New York. Government agencies like the U.S. Census Bureau employ this format for datasets, including geographic files. In regular expressions, the vertical bar functions as an alternation operator, enabling a pattern to match one of multiple specified alternatives. For example, cat|dog matches either "cat" or "dog" in a . To treat the vertical bar as a literal character rather than an operator, it requires escaping, commonly as \| in most regex engines.

Formal grammars

In formal grammars, the vertical bar serves as a key symbol for denoting alternatives within production rules, enabling concise descriptions of syntactic choices in context-free grammars. This usage originated with John Backus's notation for the report in 1959, where it separated possible expansions of non-terminals to precisely define the language's syntax. The notation was later refined and named Backus-Naur Form (BNF) by in the report, establishing it as a standard for specifying programming language grammars. In BNF, a production rule uses the vertical bar (|) to list mutually exclusive options following the double colon (::=) symbol. For instance, the syntax for a single digit can be expressed as <digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9, indicating that any one of these terminal symbols satisfies the non-terminal <digit>. This structure allows recursive definitions for complex constructs, such as arithmetic expressions: <expression> ::= <term> | <expression> + <term> | <expression> - <term>. Such rules underpin the grammars of many programming languages, including Python, where the official employs | to specify alternatives like statement ::= compound_stmt | simple_stmts. Extended Backus-Naur Form (EBNF) builds on BNF by retaining the vertical bar for alternatives while introducing additional operators, such as square brackets [] for optional elements and curly braces {} or asterisks * for repetition. For example, an EBNF rule for a comma-separated list might be <list> ::= <item> ("," <item>)*, with | used if multiple base forms for <item> are needed, like <item> ::= <number> | <string>. This extension enhances expressiveness without altering the core role of | in marking choices, and it appears in specifications for protocols and data formats. Graphical representations of s, known as or railroad diagrams, visualize alternatives through branching paths connected by vertical lines at points. These lines indicate where the parser selects one of several possible routes, mirroring the logical separation provided by | in textual BNF. For example, in a for a conditional statement, vertical lines might fork to paths representing "if-then" or "if-then-" structures. This visual aid complements textual notations, aiding comprehension of rules in definitions.

Concurrency and parallelism

In process calculi, the vertical bar symbolizes parallel composition, enabling the concurrent execution of independent processes. In the Calculus of Communicating Systems (CCS), introduced by , the notation PQP \mid Q represents the parallel execution of two processes PP and QQ, where they run independently unless they synchronize via complementary actions on shared channels. This operator is associative and commutative, allowing unrestricted interleaving of actions from PP and QQ, with the overall behavior emerging from their potential interactions. The pi-calculus, an extension of CCS developed by Milner, Parrow, and Walker, employs the same vertical bar for parallel composition, but with enhanced mobility of channel names to model dynamic communication topologies. In PQP \mid Q, processes operate concurrently, and synchronization occurs only when an output action in one matches an input in the other along the same channel, facilitating scoped interactions without inherent coupling otherwise. The absence of additional operators with | underscores non-interacting parallelism, where processes evolve autonomously until explicit is possible. In hardware description languages like , the vertical bar serves as the bitwise OR operator within concurrent procedural blocks, contributing to parallel signal evaluations. For instance, in an always block such as always @(posedge clk) a <= b | c;, the assignment computes the OR of inputs bb and cc non-blockingly, with the block executing concurrently alongside other always or assign statements to model hardware simultaneity. This usage highlights how logical operations underpin concurrent behavior in digital designs, distinct from sequential control flow.

Array and language-specific uses

In array programming languages like APL and its successor J, the vertical bar denotes the dyadic residue function, which computes the remainder when the right argument is divided by the left argument, effectively implementing a modulo operation with the arguments in reverse order compared to many other languages. For instance, in APL, the expression 3 | 10 evaluates to 1, since 10 divided by 3 yields a quotient of 3 and a remainder of 1; this function extends element-wise to arrays, making it efficient for vectorized computations on numerical data. Monadic application of the vertical bar in APL returns the absolute value of its argument, further supporting array manipulations in mathematical contexts. J, as a modern dialect of APL designed for array processing, retains this usage of the vertical bar for residue, where m | n produces the residue of n modulo m, facilitating concise expressions for tasks like cyclic indexing or hashing in array operations. This operator aligns with J's emphasis on terse, high-performance array computations, often applied to entire matrices without explicit loops. In functional languages supporting list comprehensions, such as Haskell, the vertical bar separates the output expression and input generators from conditional guards, enabling readable filtering within declarative list constructions. For example, the comprehension [x^2 | x <- [1..10], even x] generates the squares of even numbers from 1 to 10, with the vertical bar delineating the guard even x that restricts the output. This syntax, borrowed from set-builder notation, promotes clarity in defining filtered arrays or lists. Similarly, in function definitions, vertical bars introduce guards for pattern-based dispatching, as in f x | x > 0 = x; | otherwise = -x, allowing conditional logic without nested if-statements. Python, while supporting list comprehensions for array-like operations, does not utilize the vertical bar in this syntax; guards are instead prefixed with if, as in [x**2 for x in range(1,11) if x % 2 == 0]. Discussions in Python Enhancement Proposals have explored walrus-like assignment operators (e.g., :=) to enhance expressions within comprehensions, but no adoption of the vertical bar for such roles has occurred, avoiding overlap with its bitwise OR usage. In array contexts, the vertical bar can briefly reference string concatenation for joining array elements into delimited strings, though this is handled via methods like join rather than the operator itself.

Markup and formatting

In wiki markup languages, particularly MediaWiki used by projects like Wikimedia, the vertical bar (|) serves as a key delimiter for constructing tables. Tables begin with {| and end with |}, with rows separated by |- and cells defined by single or double pipes: a single | starts a new cell on a fresh line, while || separates multiple cells on the same line. For example, the syntax { | Orange || Apple | } renders as a simple two-column table row. This pipe-based syntax allows embedding complex wiki content within cells and supports attributes like classes (e.g., { | class="wikitable" | cell1 || cell2 | }), enabling styled tabular presentation without HTML tags. In , a popularized for web documentation, certain flavors such as Flavored Markdown employ the vertical bar (|) to delineate table columns. Tables are formed by separating headers and rows with , with a header row of (at least three per column) to distinguish it from data rows; pipes at the edges are optional for simplicity. An example is | First Header | Second Header | \n | ------------- | ------------- | \n | Content Cell | Content Cell |, which produces a basic aligned table. Alignment can be adjusted using colons within the hyphen row (e.g., |:---:| for centering), and pipes within cell content must be escaped as \| to avoid misinterpretation. This extension, not part of original , facilitates readable tabular data in plain text files rendered to . LaTeX, a typesetting system for technical documents, utilizes the vertical bar (|) in math mode as a basic delimiter for expressions like sets or absolute values, often paired with commands for proper spacing and scaling. The command \vert produces a single vertical bar suitable as an operator or fence, synonymous with the plain | but recommended for mathematical contexts to ensure consistent rendering. For resizable delimiters, \lvert and \rvert from the amsmath package provide left and right variants that auto-scale with \left and \right (e.g., \left\lvert x \right\rvert for x|x| matching content height), while manual sizing options like \big| or \Bigl| allow fine control in complex equations. Double bars for norms use \| or \Vert. These features enhance precise mathematical notation in documents. In and CSS, the vertical bar (|) appears sparingly in markup and styling, primarily within CSS attribute selectors to handle or hyphen-separated values. For instance, [lang|=en] targets elements with a lang attribute exactly "en" or starting with "en-" (e.g., "en-US"), using the bar as a namespace separator in qualified names like *|E for any namespace's element E. This selector type, defined in CSS specifications, supports targeted styling based on attribute patterns but is less common than basic attribute matching due to its specialized role in internationalized or modular documents.

Linguistics and typography

Phonetic transcription

In the International Phonetic Alphabet (IPA), the vertical bar (|) serves as a suprasegmental symbol to denote a minor (foot) group boundary, marking the separation of smaller prosodic units within an intonation phrase, such as a foot or minor phrase. This usage helps represent the rhythmic and intonational structure of speech, distinguishing it from larger major (intonation) group boundaries marked by double vertical bars (||). For instance, in transcribing English prosody, it can indicate a subtle pause or grouping, as in /ə nɔː| mɑːl/ for "a normal," where the bar highlights the minor phrase break after "nor."

Orthographic uses

In Hebrew , the (שְׁוָא) is a diacritical mark represented by two dots arranged vertically beneath a , indicating a reduced or vocalized sound, often an ultra-short -like in the Tiberian tradition of . This mark, which visually resembles a compact vertical bar, distinguishes vocal shewa (with phonetic value) from silent shewa (indicating consonantal quiescence or syllable closure). For instance, in the word שְׁלוֹם (, "peace"), the shewa under the shin signals a vocal onset. Additionally, the paseq (פָּסֵק), a vertical bar (׀), appears in medieval Masoretic manuscripts of the to separate words, indicate disjunctive accents, or mark special syntactic divisions, such as preventing between repeated terms like proper names. This usage underscores its role in clarifying clause boundaries and rhythmic structure in scriptural texts. In certain African writing systems, particularly those of the Khoisan languages spoken in southern Africa, the vertical bar (|) denotes a dental click consonant, a distinctive ingressive sound produced by suction at the teeth. This orthographic convention, rooted in the International Phonetic Alphabet (IPA) and adapted for practical transcription, represents one of five basic click types (alongside alveolar !, lateral ǁ, palatal ǂ, and bilabial ʘ). For example, in the Juǀʼhoan language (formerly known as !Kung), the word |xòã refers to "eland," where the initial | indicates the dental click followed by a velar fricative and nasal vowel. Such usage integrates the vertical bar into the core phonemic inventory, essential for distinguishing lexical items in these non-Bantu tonal languages. This practice parallels the capitulum, a stylized "C" intersected by a vertical bar, used for paragraph or sentence separation from the onward. In contemporary , the vertical bar occasionally serves as a substitute for the em dash (—) in plain-text environments or specific systems to denote abrupt breaks, interruptions, or parenthetical insertions, especially where full typographic control is limited. This adaptation highlights the bar's versatility in maintaining readability across media, though style guides like recommend the true em dash for formal print.

Literary and artistic applications

In and verse analysis, the vertical bar serves as a notation tool in to delineate metrical feet within a line. The (TEI) standards specify its use for marking foot divisions, with line breaks indicated separately by a solidus (/), enabling precise encoding of poetic structure in digital literary editions. This application highlights the bar's role in facilitating rhythmic and structural breakdown for scholars and performers. In music scoring, the single vertical bar functions as a bar line to separate measures, particularly in tablature systems like guitar tabs, where it divides the notation into rhythmic segments for instrumentalists. The double vertical bar (||), consisting of two closely spaced lines, denotes the end of a major section, a key change, or the conclusion of a composition, providing clear structural boundaries in scores. Artistic applications extend to experimental notation, as seen in John Cage's 4'33" (1952/1953), where vertical lines proportionally represent temporal divisions of silence across the piece's three movements, transforming absence into a measurable compositional element. This innovative use equates space to time, emphasizing ambient sounds as music.

Variants and encoding

Broken bar

The broken bar (¦) is a typographic variant of the vertical bar featuring a visible gap in its middle, designed to provide visual distinction from the solid vertical bar (|). This symbol emerged as a deliberate choice in early computing standards to differentiate it from similar glyphs, such as the when stylized vertically or other separators in programming languages like . The solid vertical bar (|) was included in the original ASA X3.4-1963 ASCII standard at code point 7Ch (decimal 124). The 1967 revision (X3.4-1967) changed it to the broken bar to resolve ambiguities in international character sets and support specific needs in programming and data transmission, particularly to distinguish from the solid bar in . By the 1977 revision of ANSI X3.4, the standard reverted to the solid vertical bar at 7Ch, reflecting a preference for the unbroken form in evolving practices. Early typewriters and computer keyboards often rendered this code point as broken to align with the 1967-1968 standards, influencing fonts in systems like PCs. In modern contexts, the broken bar appears primarily in legacy systems or specific keyboard layouts, such as the variant where it serves as an alternative to the pipe symbol via combinations. It is rarely used in , where the solid vertical bar or double bar (||) is the standard for notations like or norms. encodes the broken bar separately at U+00A6 while designating U+007C for the vertical bar in general applications, effectively discouraging the broken form for new typographic or programming uses in favor of the solid variant.

Unicode representation

The vertical bar is encoded in Unicode as U+007C VERTICAL LINE, classified under the Symbol, Math (Sm) category within the Basic Latin block. This code point represents a solid vertical line used across various scripts and contexts, with a bidirectional class of Other Neutral (ON) and no mirroring property. The character is not decomposable and has no or compatibility decompositions, ensuring its atomic representation in normalized Unicode text. A fullwidth variant exists at U+FF5C FULLWIDTH VERTICAL LINE (|), part of the block, designed for East Asian typography where it occupies a full character width equivalent to ideographs. Rendering of U+007C can vary across fonts; for instance, some monospace fonts display it as a thin, unbroken line, while proportional fonts may adjust its thickness for aesthetic balance, occasionally leading to visual confusion with similar symbols like the broken bar (U+00A6). No dedicated zero-width variant exists for the vertical bar in Unicode, though in specialized contexts such as text segmentation or invisible markup, alternatives like the (U+200B) may be used adjacently to control layout without visible interruption. As of Unicode 17.0 released in September 2025, no major changes have been made to U+007C itself.

Legacy encodings

The vertical bar character (|) was standardized in the American Standard Code for Information Interchange (ASCII) at position 124 decimal (7C hexadecimal) upon its initial publication as ASA X3.4-1963. This encoding allowed the vertical bar to be represented consistently in early digital communications and systems supporting seven-bit codes. In contrast, IBM's Extended Interchange Code (), developed in the late 1950s and widely used in mainframe systems, assigned the vertical bar to varying positions across s, such as 0x6F in 037. These discrepancies, including mappings where the vertical bar in one EBCDIC corresponded to other symbols like the in another EBCDIC , led to significant portability challenges when exchanging data between EBCDIC-based environments and ASCII systems. The International Organization for Standardization's ISO 8859-1 (Latin-1), published in 1987 for Western European languages, retained the ASCII-compatible encoding for the vertical bar at 0x7C, ensuring with seven-bit ASCII in the lower 128 code points. Early hardware implementations, such as the introduced in 1963, utilized the vertical bar within ASCII shift states for character selection and printing on electromechanical teleprinters during the 1960s. These legacy encodings laid the groundwork for later standards like , which superseded them by unifying character representations across diverse systems.

References

  1. https://www.mediawiki.org/wiki/Help:Tables
Add your contribution
Related Hubs
User Avatar
No comments yet.