The backtick is a typographical mark used mainly in
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
. It is also known as backquote, grave, or
grave accent
The grave accent () ( or ) is a diacritical mark used to varying degrees in French, Dutch, Portuguese, Italian, Catalan and many other Western European languages as well as for a few unusual uses in English. It is also used in other ...
.
The character was designed for typewriters to add a grave accent to a (lower-case) base letter, by overtyping it atop that letter. On early computer systems, however, this physical
dead key
A dead key is a special kind of modifier key on a mechanical typewriter, or computer keyboard, that is typically used to attach a specific diacritic to a base letter (alphabet), letter. The dead key does not generate a (complete) grapheme, charact ...
+overtype function was rarely supported, being functionally replaced by
precomposed character
A precomposed character (alternatively composite character or decomposable character) is a Unicode entity that can also be defined as a sequence of one or more other characters. A precomposed character may typically represent a letter with a diac ...
s. Consequently, this ASCII symbol was rarely (if ever) used in computer systems for its original aim and became repurposed for many unrelated uses in computer programming.
The sign is located on the left-top of a US or UK layout keyboard, next to the key. Provision (if any) of the backtick on other keyboards varies by national
keyboard layout
A keyboard layout is any specific physical, visual, or functional arrangement of the keys, legends, or key-meaning associations (respectively) of a computer keyboard, mobile phone, or other computer-controlled typographic keyboard. Standard keybo ...
and
keyboard mapping
A keyboard layout is any specific physical, visual, or functional arrangement of the keys, legends, or key-meaning associations (respectively) of a computer keyboard, mobile phone, or other computer-controlled typographic keyboard. Standard keybo ...
.
History
Typewriters
On typewriters designed for languages that routinely use
diacritic
A diacritic (also diacritical mark, diacritical point, diacritical sign, or accent) is a glyph added to a letter or to a basic glyph. The term derives from the Ancient Greek (, "distinguishing"), from (, "to distinguish"). The word ''diacrit ...
s (accent marks), there are two possible solutions. Keys can be dedicated to pre-composed characters or alternatively a
dead key
A dead key is a special kind of modifier key on a mechanical typewriter, or computer keyboard, that is typically used to attach a specific diacritic to a base letter (alphabet), letter. The dead key does not generate a (complete) grapheme, charact ...
mechanism can be provided. With the latter, a mark is made when a dead key is typed but, unlike normal keys, the paper carriage does not move on and thus, the next letter to be typed is printed under the accent.
Incorporation into ISO 646 and ASCII
The incorporation of the grave symbol into ASCII is a consequence of this prior existence on typewriters. This symbol did not exist independently as a
type or
hot-lead printing character.
Thus, ISO646 was born and the ASCII standard updated to include the backtick and other symbols.
As surrogate of apostrophe or (opening) single quote
Some early ASCII peripherals designed the backtick and apostrophe to be mirror images of each other: and . This allowed them to be used as matching pairs of open and close quotes while still being somewhat usable as grave and acute accents, made apostrophes typographically correct, and allowed the apostrophe to be used as a prime. This had a number of problems that led most modern systems and Unicode to render the apostrophe as a "straight" one:
* Open quote is not typographically correct: the correct form () is flipped vertically from what is shown here.
* No matching double quotes, although two single quotes looked acceptable on proportionally-spaced devices.
* Wrong appearance if used as overprinted diacritics.
* Lots of software and documents used the apostrophe for opening as well as for closing quotes.
This can still be seen in documents and email from that time (before 1990), and in output generated by some UNIX console programs such as
man pages. Institutions that traditionally had used it have abandoned or deprecated it.
Computing
Command-line interface languages
Many
command-line interface languages and the
scripting (programming) languages like
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
,
PHP,
Ruby
Ruby is a pinkish-red-to-blood-red-colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sapph ...
and
Julia (though see below) use pairs of backticks to indicate
command substitution. A command substitution is the
standard output Standard may refer to:
Symbols
* Colours, standards and guidons, kinds of military signs
* Standard (emblem), a type of a large symbol or emblem used for identification
Norms, conventions or requirements
* Standard (metrology), an object t ...
from one command, into an embedded line of text within another command. For example, using $ as the symbol representing a terminal prompt, the code line:
:
In all POSIX
shell
Shell may refer to:
Architecture and design
* Shell (structure), a thin structure
** Concrete shell, a thin shell of concrete, usually with no interior columns or exterior buttresses
Science Biology
* Seashell, a hard outer layer of a marine ani ...
s (including
Bash and
Zsh), the use of backticks for command substitution is now largely deprecated in favor of the notation
$(...)
, so that the example above would be re-written:
:
The new syntax allows nesting, for example:
:
Markup languages
It is sometimes used in
source code comments to indicate code, e.g.,
:
/* Use the `printf()` function. */
This is also the format the
Markdown formatter uses to indicate code. Some variations of Markdown support "fenced code blocks" that span multiple lines of code, starting (and ending) with three backticks in a row (
```
).
*
TeX
Tex, TeX, TEX, may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Tex Earnhardt (1930–2020), U.S. businessman
* Joe Tex (1933–1982), stage name of American soul singer ...
: The backtick character represents curly opening quotes. For example,
`
is rendered as single opening curly quote () and
``
is a double curly opening quote (). It also supplies the numeric ASCII value of an ASCII character wherever a number is expected.
Programming languages
*
BBC BASIC: The backtick character is valid at the beginning of or within a variable, structure, procedure or function name.
*
D and
Go: The backtick surrounds a
raw string literal.
*
F#: Surrounding an identifier with double backticks allows the use of identifiers that would not otherwise be allowed, such as keywords, or identifiers containing punctuation or spaces.
*
Haskell
Haskell () is a general-purpose, statically typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell pioneered several programming language ...
: Surrounding a function name by backticks makes it an
infix operator.
*
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
:
ECMAScript 6 standard introduced a "backtick" character which indicated a string or
template literal. Its applications include (but are not limited to): string interpolation (substitution), embedded expressions, and multi-line strings. In the following example
name
and
pet
variable's values get substituted into the string enclosed by grave accent characters:
::
const name = "Mary", pet = "lamb"; // Set variables
let temp = `$ has a little $!`;
console.log(temp);
// => "Mary has a little lamb!";
*
Lisp
Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation.
Originally specified in the late 1950s, ...
macro systems: The backtick character (called ''quasiquote'' in
Scheme) introduces a quoted expression in which comma-substitution may occur. It is identical to the plain quote, except that a nested expression prefixed with a
comma
The comma is a punctuation mark that appears in several variants in different languages. Some typefaces render it as a small line, slightly curved or straight, but inclined from the vertical; others give it the appearance of a miniature fille ...
is replaced with the value of that nested expression. If the nested expression happens to be a symbol (that is, a variable name in Lisp), the symbols' value is used. If the expression happens to be program code, the first value returned by that code is inserted at the respective location instead of the comma-prefixed code. This is roughly analogous to the Bourne shell's
variable interpolation with
$
inside double quotes.
*
Julia: Backticks make a command object,
Cmd
, that can be run, with run function, like
run(`echo Hello world!`)
. You can interpolate Julia variables, but only indirectly shell environment variables.
*
m4: A backtick together with an apostrophe quotes strings (to suppress or defer macro expansion).
*
MySQL
MySQL () is an Open-source software, open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A rel ...
/
MariaDB
MariaDB is a community-developed, commercially supported Fork (software development), fork of the MySQL relational database management system (RDBMS), intended to remain free and open-source software under the GNU General Public License. Developm ...
: A backtick in queries is a delimiter for column, table, and database identifiers.
*
OCaml
OCaml ( , formerly Objective Caml) is a General-purpose programming language, general-purpose, High-level programming language, high-level, Comparison of multi-paradigm programming languages, multi-paradigm programming language which extends the ...
: The backtick indicates polymorphic variants.
*
Pico: The backtick indicates comments in the programming language.
*
PowerShell
PowerShell is a shell program developed by Microsoft for task automation and configuration management. As is typical for a shell, it provides a command-line interpreter for interactive use and a script interpreter for automation via a langu ...
: The backtick is used as the escape character. For example, a newline character is denoted
`n
. Most common programming languages use a backslash as the escape character (e.g.,
\n
), but because Windows allows the backslash as a path separator, it is impractical for PowerShell to use backslash for a different purpose. Two backticks produce the
`
character itself. For example, the
nullable boolean of
.NET
The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
is specified in PowerShell as
ullable``1[System.Boolean
.
* Python (programming language)">Python: Prior to version 3.0, backticks were a synonym for the
repr()
function, which converts its argument to a string suitable for a programmer to view. However, this feature was removed in Python 3.0. Backticks also appear extensively in the reStructuredText plain text markup language (implemented in the Python docutils package).
* R (programming language), R: The backtick is used to surround non-syntactic variable names. This includes variable names containing special characters or
reserved words, among others.
*
Racket: The backtick or "Quasiquote" is used to begin creating lists.
*
Scala: An identifier may also be formed by an arbitrary string between backticks. The identifier then is composed of all characters excluding the backticks themselves.
*
Tom: The backtick creates a new term or to calls an existing term.
*
Unlambda: The backtick character denotes function application.
*
Verilog
Verilog, standardized as IEEE 1364, is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design and verification of digital circuits, with the highest level of abstraction being at the re ...
HDL: The backtick is used at the beginning of compiler's directives.
Games
In many PC-based computer games in the US and UK, the key is used to open the
console
Console may refer to:
Computing and video games
* System console, a physical device to operate a computer
** Virtual console, a user interface for multiple computer consoles on one device
** Command-line interface, a method of interacting with ...
so the user can execute script commands via its
CLI. This is true for games such as ''
Factorio'', ''
Battlefield 3'', ''
Half-Life Half-life is a mathematical and scientific description of exponential or gradual decay.
Half-life, half life or halflife may also refer to:
Film
* Half-Life (film), ''Half-Life'' (film), a 2008 independent film by Jennifer Phang
* ''Half Life: ...
'', ''
Halo CE'', ''
Quake'', ''
Half-Life 2'', ''
Blockland'', ''
Soldier of Fortune II: Double Helix'', ''
Unreal'', ''
Counter-Strike'', ''
Crysis'', ''
Morrowind
''The Elder Scrolls III: Morrowind'' is a 2002 action role-playing game developed by Bethesda Game Studios and published by Bethesda Softworks. It is the third installment in ''The Elder Scrolls'' series, following 1996's ''The Elder Scrolls I ...
'', ''
Oblivion'', ''
Skyrim'', ''
Fallout: New Vegas'', ''
Fallout 3'', ''
Fallout 4'', ''
RuneScape'', and games based on the
Quake engine or
Source engine.
While not necessarily the original progenitor of the console key concept, ''Quake'' is still widely associated with any usage of the key as a toggle for a drop-down console, often being referred to as the "Quake Key". In 2021,
Windows Terminal introduced a "Quake Mode" which enables a global shortcut of + that opens a terminal window pinned to the top half of the screen.
See also
*
Tilde
Notes
References
{{DEFAULTSORT:Backtickfb
Typographical symbols