What is the origin of != in the meaning "not equal to"?

C and the unix shells use != for not equal, it comes from the maths symbol ≠.

The earlier computer langauge FORTRAN that was (and is) used for more mathematical work uses .ne. because it was invented before the symbols on keyboards were standardised


Yes, this is from programming languages such as C and C++.

The symbol used to denote inequation — when items are not equal — is a slashed equals sign "≠" (Unicode 2260).

Most programming languages, limiting themselves to the ASCII character set, use ~=, !=, /=, =/=, or <> to represent their boolean inequality operator.

Source: Wikipedia.


(Edit: Combining vincente and Mark Hurd's comment with something extra.)

!= may have first appeared in the B language, which was a precursor to C. It does not appear in BCPL which was an inspiration for B, so perhaps the B designers were the first.

And some languages (including B and C) use ! for logical negation (aka NOT), so != is slightly more natural than > and the other ASCII-only operators. Again, BCPL is different: it uses ~a to mean "NOT a", but uses a!b for !(a+b).