In
web browsers, default settings typically distinguish
hyperlinks by underlining them (and usually changing their color), but both users and websites can change the settings to make some or all hyperlinks appear differently (or even without distinction from normal text). By 1967 the underscore had spread to
ASCII, replacing the similarly shaped left-arrow character, (see also:
PIP).
C, developed at Bell Labs in the early 1970s, allowed the underscore in identifiers. Underscore predates the existence of lower-case letters in many systems, so often it had to be used to make multi-word identifiers, since
camelCase (see below) was not available.
Programming conventions Underscores inserted between letters are very common to make a "multi-word" identifier in languages that cannot handle
spaces in identifiers. This convention is known as "
snake_case" (the other popular method is called
camelCase, where capital letters are used to show where the words start). An underscore as the first character in an
ID is often used to indicate an internal implementation that is not considered part of the
API and should not be called by code outside that implementation. In
Dart, all private properties of classes must start with an underscore; this usage is also common in other languages such as
C++ even though those provide keywords to indicate that members are private. It is extensively used to hide variables and functions used for implementations in
header files. In fact, the use of a single underscore for this became so common that C compilers had to standardize on a
double leading underscore (for instance __DATE__) for actual built-in variables to avoid conflicts with the ones in header files.
PHP "reserves all function names starting with __ [double underscore] as magical."
Python uses names that both start and end with double underscores (so called "dunder methods", as in
double
underscore) for magic members used for purposes such as operator overloading and reflection, and names starting but not ending with a double underscore to denote private
member variables of classes which should be
mangled in a manner which prevents them from colliding with members of derived classes unless the classes have the same name ( in class will be mangled to ). By convention, members starting with a single underscore are considered private or protected, although this behavior only has inherent effect for modules, where statements by default import all names that do not start with an underscore, unless an export list is explicitly defined by the module. A variable named with just an underscore often has special meaning. $_ or _ is the previous command or result in many
interactive shells, such as those of
Python,
Ruby, and
Perl. In
Perl, @_ is a special
array variable that holds the
arguments to a
function. In
Clojure, it indicates an argument whose value will be ignored. In some languages with
pattern matching, such as
Haskell and other
ML-family languages,
Rust,
C#,
Python,
Prolog, and the
Wolfram Language, the pattern _ matches any value, but does not perform
binding, hence it can be reused multiple times in a single pattern and does not require declaration.
HTML <u> and CSS The ASCII underscore character can be inserted with the
entities or (or or ). HTML has a
presentational element that was originally used to underline text; this usage was
deprecated in HTML4 in favor of the
CSS style {text-decoration: underline}. In HTML5, the tag reappeared but its meaning was changed significantly: it now "represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation". The elements may also exist in other
markup languages, such as
MediaWiki. The
Text Encoding Initiative (TEI) provides an extensive selection of related elements for marking editorial activity (insertion, deletion, correction, addition, etc.).
Unicode Unicode has a free-standing underscore at U+005F, inherited from ASCII, which is a legacy of the typewriter practice of underlining using backspace and overtype. Modern practice uses the
combining diacritic that results in an underline when run together: u̲n̲d̲e̲r̲l̲i̲n̲e̲. Unicode also has . In addition, there are single line and double line versions of the
combining macron below, a diacritic that applies to single letters only.
"Simulated" underlines in plain-text In
plain-text applications, including plain-text
e-mails where emphasis markup is not possible, the desired emphasis is often indicated by surrounding words with underscore characters. For example, "You must use _emulsion_ paint on the ceiling". Some applications will automatically add
emphasis to text manually bracketed by underscores, either by underlining or by italicizing it (e.g. may render as either or
string).
As a marker for incorrectness Underline (typically red or wavy or both) is often used by
spell checkers (and
grammar checkers) to denote misspelled or otherwise incorrect text. ==Manuscripts==