**+ (addition)
- (subtraction)**
Plus and minus signs - Wikipedia
Nicole Oresme's manuscripts from the 14th century show what may be one of the earliest uses of + as a sign for plus.
...
The + sign is a simplification of the Latin: et (comparable to the evolution of the ampersand &).[7] The − may be derived from a tilde written over ⟨m⟩ when used to indicate subtraction; or it may come from a shorthand version of the letter ⟨m⟩ itself.[8]
**+ (concatenation)**
history - What was the first programming language to use `+` for string concatenation? - Retrocomputing Stack Exchange
The earliest that was easy to find was ALGOL 68.
...
The eighth version of Dartmouth BASIC released in 1971 was the first to support string concatenation, but the operator was &.
**= (mathematics)**
Equals sign - Wikipedia
The = symbol, now universally accepted in mathematics for equality, was first recorded by Welsh mathematician Robert Recorde in The Whetstone of Witte (1557).[4] The original form of the symbol was much wider than the present form.
**= (assignment)**
704_FortranProgRefMan_Oct56.pdf
[source: Fortran Programmer's Reference Manual (1956)]
Hierarchy of operations.
...
Exponentiation
Multiplication and Division
Addition and Subtraction
...
A+B/C+D**E+F-G
**= (comparison)
== (comparison)
!= (comparison: not equal)
:= (assignment) ('walrus operator')**
history - Why was `!` chosen for negation? - Retrocomputing Stack Exchange
Finally, note that B also introduced the equality operators == (equal to) and != (not equal to), also not present in its predecessor
Relational operator - Wikipedia
Early FORTRAN (1956–57) was bounded by heavily restricted character sets where = was the only relational operator available. There were no < or > (and certainly no ≤ or ≥). This forced the designers to define symbols such as .GT., .LT., .GE., .EQ. etc. and subsequently made it tempting to use the remaining = character for copying, despite the obvious incoherence with mathematical usage (X=X+1 should be impossible).
International Algebraic Language (IAL, ALGOL 58) and ALGOL (1958 and 1960) thus introduced := for assignment, leaving the standard = available for equality, a convention followed by CPL, ALGOL W, ALGOL 68, Basic Combined Programming Language (BCPL), Simula, SET Language (SETL), Pascal, Smalltalk, Modula-2, Ada, Standard ML, OCaml, Eiffel, Object Pascal (Delphi), Oberon, Dylan, VHSIC Hardware Description Language (VHDL), and several other languages.
...
In the same process, the ALGOL style := of BCPL was replaced by = in B. The reason for all this being unknown.[8] As variable updates had no special syntax in B (such as let or similar) and were allowed in expressions, this non standard meaning of the equal sign meant that the traditional semantics of the equal sign now had to be associated with another symbol. Ken Thompson used the ad hoc == combination for this.
**<> (comparison: not equal)**
Relational operator - Wikipedia
BASIC, ML, Pascal
**? : (ternary operator)**
Ternary conditional operator - Wikipedia
It originally comes from CPL, in which equivalent syntax for e1 ? e2 : e3 was e1 → e2, e3.
**! (exclamation mark)**
**! (factorial)**
Christian Kramp - Wikipedia
He was the first to use the notation n! (Elements d'arithmétique universelle, 1808).
**! (logical not)**
history - Why was `!` chosen for negation? - Retrocomputing Stack Exchange
The ! was around as part of the B programming language, according to the "User's Reference For B" (K Thompson, Jan 1972).
**! (click consonant)**
**{ } (code blocks)**
BCPL - Wikipedia
BCPL introduced several features of many modern programming languages, including using curly braces to delimit code blocks.
...
BCPL was the first brace programming language and the braces survived the syntactical changes and have become a common means of denoting program source code statements.
**% (percentage)**
**% (modulo)**
Why didn't they use a new symbol for modulo instead of reusing the symbol for percentage? Inventing a new symbol isn't hard, like the inverted 'T' or rotated 'K'. Imagine someone learning percent and modulo on the same day, it would be confusing. - Quora
Modulo - Wikipedia
**%% (floor modulo)**
*** (footnote)**
*** (multiplication)**
Earliest Uses of Symbols of Operation - MacTutor History of Mathematics
The asterisk (*) was used by Johann Rahn (1622-1676) in 1659 in Teutsche Algebra (Cajori vol. 1, page 211).
Asterisk
In 1668, the Swiss author Johan Heinrich Rahn was the first to introduce the asterisk to indicate multiplication, in his algebraic treatise Teutsche Algebra.
syntax - Why do programming languages use the asterisk * for multiplication? - Programming Language Design and Implementation Stack Exchange
FORTRAN's Preliminary Report in 1954 anticipated using the × symbol for multiplication (and ×× for exponentiation). The 1956 Programmer's Reference Manual, which is the first manual for a working version, notes that the multiplication symbol is *.
704_FortranProgRefMan_Oct56.pdf
[source: Fortran Programmer's Reference Manual (1956)]
Hierarchy of operations.
...
Exponentiation
Multiplication and Division
Addition and Subtraction
...
A+B/C+D**E+F-G
*** (dereference)**
*** (splat/spread operator)
... (spread/splat operator)**
javascript - Does JS's spread syntax appear in other languages? - Stack Overflow
Variadic function - Wikipedia
*** (emphasis)**
*** (censorship/redaction/passwords)**
**** (exponentiation)**
704_FortranProgRefMan_Oct56.pdf
[source: Fortran Programmer's Reference Manual (1956)]
Hierarchy of operations.
...
Exponentiation
Multiplication and Division
Addition and Subtraction
...
A+B/C+D**E+F-G
**/* */ (comment blocks)**
Asterisk - Wikipedia
In the B programming language and languages that borrow syntax from it, such as C, PHP, Java, or C#, comments in the source code (for information to people, ignored by the compiler) are marked by an asterisk combined with the slash:
**⋅ (multiplication)**
**× (multiplication)**
**/ (division)**
704_FortranProgRefMan_Oct56.pdf
[source: Fortran Programmer's Reference Manual (1956)]
Hierarchy of operations.
...
Exponentiation
Multiplication and Division
Addition and Subtraction
...
A+B/C+D**E+F-G
**\ (directory)
/ (directory)**
**\ (string escape character)**
Escape character - Wikipedia
**// (comment)**
BCPL - Wikipedia
The single-line // comments of BCPL, which were not adopted by C, reappeared in C++ and later in C99.
**// (floor division)**
**~/ (integer division)**
Operators | Dart
**+= (note: variants: =+ and +:=)**
B (programming language) - Wikipedia
Thompson added "two-address assignment operators" using x =+ y syntax to add y to x (in C the operator is written +=). This syntax came from Douglas McIlroy's implementation of TMG, in which B's compiler was first implemented (and it came to TMG from ALGOL 68's x +:= y syntax).
historien-om-C.pdf
Development of C
...
For example, B introduced generalized assignment operators, using x=+y
to add y to x. The notation came from Algol 68 [Wijngaarden 75] via McIlroy, who had incorporated
it into his version of TMG. (In B and early C, the operator was spelled =+ instead of += ;
this mistake, repaired in 1976, was induced by a seductively easy way of handling the first form
in B’s lexical analyzer.)
historien-om-C.pdf
[source: Dennis M. Ritchie - The Development of the C Language (1993)]
Thompson went a step further by inventing the ++ and -- operators, which increment or
decrement; their prefix or postfix position determines whether the alteration occurs before or after
noting the value of the operand. They were not in the earliest versions of B, but appeared along
the way.
[source: Brian W. Kernighan & Dennis M. Ritchie - The C Programming Language (1978) p.215]
Assignment operators all have the same priority, and all group right-to-left.
asgnop:
= += -= *= /= %= >>= <<= &= ^= |=
**++ (increment)
-- (decrement)**
B (programming language) - Wikipedia
Thompson went further by inventing the increment and decrement operators (++ and --).
historien-om-C.pdf
[source: Dennis M. Ritchie - The Development of the C Language (1993)]
Thompson went a step further by inventing the ++ and -- operators, which increment or
decrement; their prefix or postfix position determines whether the alteration occurs before or after
noting the value of the operand. They were not in the earliest versions of B, but appeared along
the way.
**& (bitwise and)
| (bitwise or)**
Relational operator - Wikipedia
B started off as a syntactically changed variant of the systems programming language BCPL, a simplified (and typeless) version of CPL. In what has been described as a "strip-down" process, the and and or operators of BCPL[6] were replaced with & and | (which would later become && and ||, respectively.[7]).
**& (address)**
**^ (bitwise xor)**
Exclusive or - Wikipedia
^, the caret, has been used in several programming languages to denote the bitwise exclusive or operator, beginning with C[20] and also including C++, C#, D, Java, Perl, Ruby, PHP and Python.
programming languages - Why was the caret used for XOR instead of exponentiation? - Software Engineering Stack Exchange
[Update] I sent email to Ken Thompson, creator of B and one of the co-creators of C, inquiring about the rationale for choosing ^ as C's XOR operator, and asking permission to share the answer here. His reply (slightly reformatted for readability):
From: Ken Thompson
Sent: Thursday, September 29, 2016 4:50 AM
To: Norbert Juffa
Subject: Re: Rationale behind choice of caret as XOR operator in C?
it was a random choice of the characters left.
[source: Brian W. Kernighan & Dennis M. Ritchie - The C Programming Language (1978) p.44]
C provides a number of operators for bit manipulation; these may not
be applied to float or double.
& bitwise AND
| bitwise inclusive OR
^ bitwise exclusive OR
<< left shift
>> right shift
- one's complement (unary)
**^ (exponentiation)**
history - How were the signs for logical and arithmetic operators decided? - Retrocomputing Stack Exchange
The convention of ^ for exponentiation derived from Algol’s choice of ↑ (perhaps because it represents raising the exponent). Dartmouth BASIC in 1964 originally used this symbol as well, despite being primarily based on Fortran. Some early teletypes and computers displayed character 5E as ↑, but ASCII standardized it as ^, and BASIC was the first language to officially make exponentiation ^. This symbol was later adopted by AWK and Donald E. Knuth’s TeX. The ubiquity of TeX in mathematics is probably what led other languages used primarily by mathematicians to follow suit.
**~ (bitwise not)**
history - Why was `!` chosen for negation? - Retrocomputing Stack Exchange
BCPL defined a number of logical operators, but these were all bitwise logical operators:
**<< (bitshift left)
>> (bitshift right signed)**
Arithmetic shift - Wikipedia
ActionScript 3, Java, JavaScript, Python,
PHP, Ruby, C, C++,[1]D, C#, Go, Julia,
Rust[2] (signed types only),
Swift (signed types only)
**>>> (bitshift right unsigned)**
Operators
**&& (logical and)
|| (logical or)**
historien-om-C.pdf
[source: Dennis M. Ritchie - The Development of the C Language (1993)]
At the suggestion of Alan Snyder, I introduced the && and || operators to make the mechanism
more explicit.
**< (less than)
> (greater than)**
**<= (less than or equal to)
>= (greater than or equal to)**
**< > (angle brackets)**
**÷ (division)
∴ (therefore)**
Johann Rahn - Wikipedia
Johann Rahn[1] (Latinised form Rhonius) (10 March 1622 – 25 May 1676) was a Swiss mathematician who is credited with the first use of the division sign, ÷ (a repurposed obelus variant)[2] and the therefore sign, ∴.[3] The symbols were used in Teutsche Algebra, published in 1659. John Pell collaborated with Rahn in this book, which contains an example of the Pell equation. It is uncertain whether Rahn or Pell was responsible for introducing the symbols.
**; (comments)**
**; (statement separator)**
**<!-- --> (comments)**
**( ) (casting)**
**[ ] (array index)**
**{ } (define object)**
**" " (literal string)**
**<=> (comparison) (spaceship operator)**
What is the Ruby <=> (spaceship) operator? - Stack Overflow
It's also known as the Three-Way Comparison Operator. Perl was likely the first language to use it. Some other languages that support it are Apache Groovy, PHP 7+, and C++20.
**!== (comparison: not equal) (type safe)
=== (comparison: equals) (type safe)**
**=> (fat-arrow function)**
**-> (member access**
**?: (Elvis operator)
?? (null coalescing operator)
|| (as Elvis operator: return an operand, not necessarily a boolean)**
Why is the Elvis operator not more common? - Programming Language Design and Implementation Stack Exchange
C and C++: no Elvis in the standards, since concise syntax sugar does not seem to be focus for these languages
Java: Elvis was explicitly rejected, seemingly also because syntax sugar is not a focus for Java.
C#: ?? is a null-checking Elvis
Python: or works as truthy-checking Elvis
JavaScript: || works as an Elvis operator that checks for truthiness, ?? is an Elvis operator that only checks for null and undefined
PHP: ?: is a truthy-checking Elvis, ?? is a null-checking Elvis
Ruby: || works as a truthy-checking Elvis
Go: no Elvis, since Go prefers simplicity of language to conciseness of code
Swift: ?? is a nil-checking Elvis
Rust: no Elvis, presumably because Rust does not have concepts similar to truthiness or null
...
Rust has .or(...) for Options, which acts a bit like Elvis for two Option-wrapped values
Elvis operator - Wikipedia
ECMA-262 - Ecma International
ECMA-262_1st_edition_june_1997.pdf
Note that the value produced by a && or || operator is not necessarily of type Boolean. The value produced will
always be the value of one of the two operand expressions.
Python Documentation by Version | Python.org
2.1.2 Boolean Operations
[source: Python 1.4 documentation (1996)]
x or y: if x is false, then y, else x
x and y: if x is false, then x, else y
Index of /download/releases/src
python1.0.1.tar.gz
[source: Python 1.01 documentation (1994)]
>>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance'
>>> non_null = string1 or string2 or string3
>>> non_null
'Trondheim'
**.. (range)**
Ellipsis (computer programming) - Wikipedia
In some programming languages (including Ada, Perl, Ruby, Apache Groovy, Kotlin, Haskell, and Pascal), a shortened two-dot ellipsis is used to represent a range of values given two endpoints
syntax - When does "1..10" make sense? - Stack Overflow
**. (member access)**
**. (concatenation)**
Comparison of programming languages (string functions) - Wikipedia
Perl, PHP

**for (;;)**
B (programming language) - Wikipedia
The semicolon version of the for loop was borrowed by Ken Thompson from the work of Stephen Johnson.
**'hello world'**
BCPL - Wikipedia
BCPL is the language in which the original "Hello, World!" program was written.[5] The first MUD was also written in BCPL (MUD1).
**'string'**
terminology - Etymology of "String" - Software Engineering Stack Exchange
The OED have done this work already. The entry for string (paywall, but UK library members are probably able to access) has "1954 Jrnl. Assoc. Computing Machinery 1 120/2 A finite, possibly null, sequence of members of the alphabet is called a string." which looks to me to be exactly the modern usage.
**chained comparison operators**
Python Documentation by Version | Python.org
2.1.3 Comparisons
[source: Python 1.4 documentation (1996)][the functionality is at least as old as Python 1.0.1 (1994)]
Comparisons can be chained arbitrarily, e.g. x < y <= z is equivalent to x < y and y <= z, except that y is evaluated only once (but in both cases z is not evaluated at all when x < y is found to be false).