Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Backslash
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Programming languages=== In many [[programming language]]s such as [[C (programming language)|C]], [[Perl]], [[PHP]], [[Python (programming language)|Python]] and [[Unix]] scripting languages, and in many file formats such as [[JSON]], the backslash is used as an [[escape character]], to indicate that the character following it should be treated specially (if it would otherwise be treated literally), or literally (if it would otherwise be treated specially). For instance, inside a C [[string literal]] the sequence {{code|\n}} produces a [[newline]] byte instead of an 'n', and the sequence {{code|\"}} produces an actual double quote rather than the special meaning of the double quote ending the string. An actual backslash is produced by a double backslash {{code|\\}}. [[Regular expression]] languages used it the same way, changing subsequent literal characters into [[metacharacter]]s and vice versa. For instance {{mono|\{{vbar}}{{vbar}}b}} searches for either '|' or 'b', the first bar is escaped and searched for, the second is not escaped and acts as an "or". {{anchor|line-continuation}}Outside quoted strings, the only common use of backslash is to ignore ("escape") a newline immediately after it. In this context it may be called a "continued line"<ref>{{cite web |url=https://gcc.gnu.org/onlinedocs/gcc-3.2.3/cpp/Initial-processing.html |title=The C Preprocessor |website=[[GNU]].org |access-date=2021-01-04 |archive-date=2021-08-03 |archive-url=https://web.archive.org/web/20210803000553/https://gcc.gnu.org/onlinedocs/gcc-3.2.3/cpp/Initial-processing.html |url-status=live }}</ref> as the current line continues into the next one. Some software replaces the backslash+newline with a space.<ref>{{cite book|chapter=3.1.1 Splitting long lines|title=GNU {{font|make|size=80%}} manual|chapter-url=https://www.gnu.org/software/make/manual/make.html#Splitting-Lines|access-date=July 28, 2019|archive-date=June 5, 2018|archive-url=https://web.archive.org/web/20180605023853/https://www.gnu.org/software/make/manual/make.html#Splitting-Lines|url-status=live}}</ref> To support [[computers]] that lacked the backslash character, the [[C trigraph]] {{code|??/}} was added, which is equivalent to a backslash. Since this can escape the next character, which may itself be a {{code|?}}, the primary modern use may be for [[code obfuscation]]. Support for trigraphs in [[C++]] was removed in [[C++17]], and support for them in C is planned to be removed in [[C23 (C standard revision)|C23]]. In [[Visual Basic]] (and some other [[BASIC]] dialects) the backslash is used as an operator symbol to indicate [[Integer (computer science)|integer]] [[Division (mathematics)|division]].<ref>{{cite web|title=Arithmetic Operators in Visual Basic|url=http://msdn.microsoft.com/en-us/library/b6ex274z(v=vs.110).aspx|work=Visual Basic Language Features: Operators and Expressions| date=10 July 2012 |publisher=MSDN|access-date=7 October 2012|archive-date=17 September 2012|archive-url=https://web.archive.org/web/20120917100112/http://msdn.microsoft.com/en-us/library/b6ex274z(v=vs.110).aspx|url-status=live}}</ref> This rounds toward zero. The [[ALGOL 68]] programming language uses the "\" as its [[Scientific notation|Decimal Exponent Symbol]]. ALGOL 68 has the choice of 4 Decimal Exponent Symbols: e, E, \, or <sub>10</sub>. Examples: {{mono|6.0221415e23}}, {{mono|6.0221415E23}}, {{mono|6.0221415\23}} or {{mono|6.0221415<sub>10</sub>23}}.<ref>{{cite journal | title=Revised Report on the Algorithmic Language Algol 68 | journal=Acta Informatica | volume=5 | issue=1β3 | pages=1β236 | date=September 1973 | doi=10.1007/BF00265077 | s2cid=2490556 | url=https://ir.cwi.nl/pub/13447 | access-date=2020-02-10 | archive-date=2020-07-26 | archive-url=https://web.archive.org/web/20200726125450/https://ir.cwi.nl/pub/13447 | url-status=live }}</ref> In [[APL (programming language)|APL]] {{mono|\}} is called ''Expand'' when used to insert fill elements into arrays, and ''Scan'' when used to produce prefix reduction (cumulative fold). In [[PHP]] version 5.3 and higher, the backslash is used to indicate a [[namespace]].<ref>{{cite web |url=http://php.net/manual/en/language.namespaces.rationale.php |title=Namespaces overview |website=php.net |access-date=2012-10-10 |archive-date=2012-10-16 |archive-url=https://web.archive.org/web/20121016184321/http://www.php.net/manual/en/language.namespaces.rationale.php |url-status=live }}</ref> In [[Haskell (programming language)|Haskell]], the backslash is used both to introduce special characters and to introduce [[anonymous function|lambda functions]] (since it is a reasonable approximation in ASCII of the Greek letter {{nowrap|lambda, Ξ»)}}.<ref>O'Sullivan, Stewart, and Goerzen, ''Real World Haskell'', ch. 4: anonymous (lambda) functions, p.99</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Backslash
(section)
Add topic