Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Colon (punctuation)
(section)
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!
==Computing== The character was on early typewriters and therefore appeared in most text encodings, such as [[Baudot code]] and [[EBCDIC]]. It was placed at code 58 in [[ASCII]] and from there inherited into Unicode. Unicode also defines several related characters: *{{unichar|003A}} *{{unichar|02D0}}, used in [[International Phonetic Alphabet|IPA]].<ref>{{cite web |title=The International Phonetic Alphabet |url=http://weston.ruter.net/projects/ipa-chart/view/ |work=Weston Ruter |access-date=27 October 2011 |year=2005 |archive-date=29 July 2012 |url-status=live |archive-url=https://archive.today/20120729122639/http://westonruter.github.com/ipa-chart/}}</ref> *{{unichar|10781}}, IPA modifier-letter.<ref name="L220252">{{cite web |title=L2/20-252R: Unicode request for IPA modifier-letters (a), pulmonic |url=https://www.unicode.org/L2/L2020/20252r-mod-ipa-a.pdf |date=2020-11-08 |last1=Miller |first1=Kirk |last2=Ashby |first2=Michael |access-date=2022-09-21 |archive-date=2021-07-30 |archive-url=https://web.archive.org/web/20210730010133/https://www.unicode.org/L2/L2020/20252r-mod-ipa-a.pdf |url-status=live}}</ref> *{{unichar|02D1}}, used in IPA. *{{unichar|10782}}, IPA modifier-letter.<ref name="L220252"/> *{{unichar|02F8}}, used by [[Uralic Phonetic Alphabet]].<ref>{{cite web |url=https://www.unicode.org/L2/L2002/02141-n2419-uralic-phonetic.pdf |title=L2/02-141: Uralic Phonetic Alphabet characters for the UCS |date=20 March 2002 |first1=Michael |last1=Everson |display-authors=etal |archive-date=19 February 2018 |url-status=live |archive-url=https://web.archive.org/web/20180219081033/https://www.unicode.org/L2/L2002/02141-n2419-uralic-phonetic.pdf}}</ref> *{{unichar|05C3}}, compatible with right-to-left text. *{{unichar|2236}}, for mathematical usage. *{{unichar|2254}}, for use in pretty-printing programming languages. *{{unichar|2255}}<ref>{{cite web |url=https://www.unicode.org/L2/L2000/00119-math.pdf |title=L2/00-119: Encoding Additional Mathematical Symbols in Unicode |last1=Whistler |first1=Ken |last2=Freytag |first2=Asmus |date=19 April 2000 |archive-date=19 February 2018 |url-status=live |archive-url=https://web.archive.org/web/20180219085257/https://www.unicode.org/L2/L2000/00119-math.pdf}}</ref> *{{unichar|2360}} *{{unichar|2982}} *{{unichar|2A74}} *{{unichar|205D|nlink=}} *{{unichar|2AF6}} *{{unichar|A789}}, see [[Colon (letter)]]. (This character is also sometimes used in [[Microsoft Windows|Windows]] [[filename]]s as it is identical to the colon in the [[Segoe UI]] font used for filenames. The colon itself is not permitted as it is a [[reserved character]].) *{{unichar|FE13}}, compatibility character for the Chinese Standard [[GB 18030]]. *{{unichar|FF1A}}, for compatibility with [[halfwidth and fullwidth forms|halfwidth and fullwidth fonts]]. *{{unichar|FE55}}, compatibility character for the Chinese National Standard [[CNS 11643]]. ===Programming languages=== {{See also|Semicolon#Computing usage}} Many programming languages, most notably [[ALGOL]], [[Pascal (programming language)|Pascal]] and [[Ada (programming language)|Ada]], use a colon and equals sign {{code|1=:=}} as the [[assignment (computer science)|assignment operator]], to distinguish it from a single equals {{code|1==}} which is an equality test ([[C (programming language)|C]] instead uses a single equals as assignment, and a double equals {{code|1===}} as the equality test).<ref>{{cite web |url=https://wiki.freepascal.org/Becomes |title=Becomes |website=Free Pascal and Lazarus Wiki |date=4 February 2021 |archive-date=2 March 2022 |archive-url=https://web.archive.org/web/20220302024707/https://wiki.freepascal.org/Becomes |url-status=live}}</ref><ref>{{cite web |url=http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-5-2.html |title=Ada Reference Manual – 5.2 Assignment Statements |publisher=Ada Conformity Assessment Authority |year=2012 |archive-date=20 May 2020 |archive-url=https://archive.today/20200520204221/http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-5-2.html |url-status=live}}</ref> Many languages including [[C (programming language)|C]] and [[Java (programming language)|Java]] use the colon to indicate the text before it is a [[label (computer science)|label]], such as a target for a [[goto]] or an introduction to a case in a [[switch statement]].<ref name='c99'>{{cite web |author=ISO/IEC JTC1/SC22/WG14 |date=7 September 2007 |url=https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf |title=ISO/IEC 9899:TC3 – Programming languages – C |archive-date=16 April 2020 |archive-url=https://archive.today/20200416164053/http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf |url-status=live}}</ref>{{rp|p=131}}<ref>{{cite web |url=https://docs.oracle.com/javase/specs/jls/se18/html/jls-14.html |title=The Java Language Specification – Chapter 14. Blocks, Statements, and Patterns |website=Oracle Help Center |date=23 February 2022 |publisher=Oracle |archive-date=8 June 2022 |archive-url=https://web.archive.org/web/20220608143908/https://docs.oracle.com/javase/specs/jls/se18/html/jls-14.html |url-status=live}}</ref> In a related use, [[Python (programming language)|Python]] uses a colon to separate a control statement (the ''clause header'') from the block of statements it controls (the ''suite''):<ref>{{cite web |title=The Python Language Reference – 8. Compound statements |date=22 January 2016 |publisher=Python Software Foundation |url=https://docs.python.org/3/reference/compound_stmts.html |url-status=live |archive-url=https://archive.today/20160126080617/https://docs.python.org/3/reference/compound_stmts.html |archive-date=26 January 2016}}</ref> <syntaxhighlight lang="python"> if test(x): print("test(x) is true!") else: print("test(x) is not true...") </syntaxhighlight> In many languages, including [[JavaScript]], colons are used to define [[name–value pair]]s in a [[JSON|dictionary]] or [[Object (computer science)|object]].<ref>{{cite book |author=ECMA TC39 |title=ECMA-262 |edition=13th |publisher=Ecma International |date=June 2022 |url=https://www.ecma-international.org/wp-content/uploads/ECMA-262_13th_edition_june_2022.pdf |archive-date=4 July 2022 |url-status=live |archive-url=https://web.archive.org/web/20220704012713/https://www.ecma-international.org/wp-content/uploads/ECMA-262_13th_edition_june_2022.pdf}}</ref>{{rp|pp=96–100}} This is also used by data formats such as [[JSON]].{{Ref RFC|8259}} Some other languages use an equals sign. <syntaxhighlight lang="javascript"> var obj = { name: "Charles", age: 18, } </syntaxhighlight> The colon is used as part of the [[?:]] conditional operator in C and many other languages.<ref name='c99'/>{{rp|p=90}} [[C++]] uses a double colon as the [[scope resolution operator]], and [[class member function|class member access]].<ref>{{cite web |url=https://en.cppreference.com/w/cpp/language/identifiers |title=Identifiers |website=C++ Reference |date=16 June 2022 |archive-date=22 July 2022 |archive-url=https://web.archive.org/web/20220722004426/https://en.cppreference.com/w/cpp/language/identifiers |url-status=bot: unknown |access-date=28 July 2022}}</ref> Most other languages use a period but C++ had to use this for compatibility with C. Another language using colons for scope resolution is [[Erlang (programming language)|Erlang]], which uses a single colon.<ref>{{cite web |url=https://www.erlang.org/doc/reference_manual/expressions.html |title=Erlang Reference Manual – Expressions |website=Erlang |date=15 July 2022 |publisher=Ericsson |archive-date=21 July 2022 |archive-url=https://web.archive.org/web/20220721195015/https://www.erlang.org/doc/reference_manual/expressions.html |url-status=bot: unknown |access-date=28 July 2022}}</ref> In [[BASIC]], it is used as a separator between the statements or instructions in a single line. Most other languages use a semicolon, but BASIC had used semicolon to separate items in print statements.<ref>{{cite web |url=https://docs.microsoft.com/en-gb/dotnet/visual-basic/programming-guide/program-structure/special-characters-in-code |title=Special Characters in Code (Visual Basic) |website=Microsoft Docs |publisher=Microsoft |date=15 September 2021 |archive-date=11 April 2022 |archive-url=https://web.archive.org/web/20220411195955/https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/program-structure/special-characters-in-code |url-status=live}}</ref> In [[Forth (programming language)|Forth]], a colon ''precedes'' definition of a new word.<ref>{{cite web |url=https://forth-standard.org/standard/core/Colon |title=Core: Glossary |website=Forth Standard |publisher=Forth-Standard-Committee |archive-date=17 November 2015 |archive-url=https://web.archive.org/web/20151117054836/https://forth-standard.org/standard/core/Colon |url-status=live}}</ref> [[Haskell]] uses a colon (pronounced as "[[cons]]", short for "construct") as an operator to add a [[data element]] to the front of a [[List (computing)|list]]:<ref>{{cite book |last1=O'Sullivan |first1=Bryan |last2=Stewart |first2=Don |last3=Goerzen |first3=John |date=2007–2008 |title=Getting Started |url=https://book.realworldhaskell.org/read/getting-started.html |publisher=Real World Haskell |access-date=8 November 2011 |url-status=live |archive-url=https://archive.today/20120710090552/http://book.realworldhaskell.org/read/getting-started.html |archive-date=10 July 2012}}</ref> <syntaxhighlight lang="haskell">"child" : ["woman", "man"] -- equals ["child","woman","man"]</syntaxhighlight> while a double colon <code>::</code> is read as "has type of" (compare [[Scope resolution operator#Haskell|scope resolution operator]]):<ref>{{cite book |first1=Miran |last1=Lipovača |date=April 2011 |url=https://learnyouahaskell.com/types-and-typeclasses |chapter=Types and Typeclasses |title=Learn You a Haskell for Great Good! |publisher=No Starch Press |isbn=978-1593272838 |access-date=8 November 2011 |archive-date=10 July 2012 |archive-url=https://archive.today/20120710015700/http://learnyouahaskell.com/types-and-typeclasses |url-status=live}}</ref> <syntaxhighlight lang="haskell">("text", False) :: ([Char], Bool)</syntaxhighlight> The [[ML (programming language)|ML]] languages (such as [[Standard ML]]) have the above reversed, where the double colon (<code>::</code>) is used to add an element to the front of a list; and the single colon (<code>:</code>) is used for type guards.<ref>{{cite book |last1=Milner |first1=Robin |author1-link=Robin Milner |last2=Tofte |first2=Mads |author2-link=Mads Tofte |last3=Harper |first3=Robert |author3-link=Robert Harper (computer scientist) |first4=David |last4=MacQueen |title=The Definition of Standard ML |edition=Revised |publisher=MIT Press |year=1997 |isbn=0-262-63181-4 |url=https://smlfamily.github.io/sml97-defn.pdf |archive-date=30 April 2020 |url-status=live |archive-url=https://web.archive.org/web/20200430075159/https://smlfamily.github.io/sml97-defn.pdf}}</ref>{{rp|pp=20, 70}} [[MATLAB]] uses the colon as a binary operator to generate a vector, or to select a part of an extant matrix. [[APL (programming language)|APL]] uses the colon: * to introduce a [[Control flow|control structure]] element. In this usage it must be the first non-blank character of the line.<ref name="DyalogAPL">{{cite web |url=http://docs.dyalog.com/13.0/Dyalog%20APL%20Language%20Reference.v13.0.pdf |title=Dyalog APL Language Reference Manual |access-date=14 February 2012 |date=April 2011 |publisher=Dyalog Limited |archive-date=4 March 2016 |archive-url=https://web.archive.org/web/20160304040415/http://docs.dyalog.com/13.0/Dyalog%20APL%20Language%20Reference.v13.0.pdf |url-status=live}}</ref>{{Rp|p=64}} * after a label name that will be the target of a <code>:goto</code> or a right-pointing arrow (this style of programming is deprecated and programs are supposed to use control structures instead).<ref name="DyalogAPL"/>{{Rp|p=64}} * to separate a guard ([[Boolean expression]]) from its expression in a dynamic function.<ref name="DyalogAPL"/>{{Rp|p=111}} Two colons are used for an Error guard (one or more error numbers).<ref name="DyalogAPL"/>{{Rp|p=115}} * Colon + space are used in class definitions to indicate inheritance.<ref name="DyalogAPL"/>{{Rp|p=135}} * ⍠ (a colon in a box) is used by APL for its variant operator.<ref name="DyalogAPL"/>{{Rp|p=340}} The colon is also used in many operating systems commands.<ref>{{cite web |url=https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#colon |title=colon – null utility |website=IEEE Std 1003.1-2017 |year=2018 |publisher=The Open Group |archive-date=17 October 2018 |archive-url=https://archive.today/20181017145503/http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html |url-status=live}}</ref> In the [[esoteric programming language]] [[INTERCAL]], the colon is called ''two-spot'' and used to label a [[32-bit computing|32-bit]] variable, distinct from ''spot'' (.) to label a [[16-bit computing|16-bit]] variable.<ref>{{cite web |last1=Woods |first1=Donald R. |author1-link=Don Woods (programmer) |last2=Lyon |first2=James M. |year=1973 |url=http://oops.se/~urban/pit/intercal.ps |format=PS |url-status=dead |archive-url=https://web.archive.org/web/20110716084816/http://oops.se/~urban/pit/intercal.ps |title=INTERCAL reference manual |archive-date=2011-07-16 |access-date=2012-03-10}}</ref>{{Rp|p=3}} ===Addresses=== Internet URLs use the colon to separate the protocol (such as {{code|http:}}) from the [[hostname]] or [[IP address]].{{Ref RFC|3986|repeat=yes}} In an [[IPv6 address#Representation|IPv6 address]], colons (and one optional double colon) separate up to 8 groups of 16 [[bit]]s in [[hexadecimal]] representation.{{Ref RFC|4291}} In a [[URL]], a colon follows the initial scheme name (such as Hypertext Transfer Protocol ([[HTTP]]) and [[File Transfer Protocol]] (FTP), and separates a [[port number]] from the [[hostname]] or [[IP address]].{{Ref RFC|3986}} In [[Microsoft Windows]] [[filename]]s, the colon is reserved for use in [[fork (file system)#Microsoft|alternate data streams]] and cannot appear in a filename.<ref>{{cite web |url=https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ffb795f3-027d-4a3c-997d-3085f2332f6f |title=[MS-FSCC]: 2.1.5 Pathname |website=Microsoft Docs |publisher=Microsoft |date=24 August 2020 |archive-date=22 October 2020 |archive-url=https://archive.today/20201022102028/https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/ffb795f3-027d-4a3c-997d-3085f2332f6f |url-status=live}}</ref> It was used as the directory separator in [[Classic Mac OS]], and was difficult to use in early versions of the newer [[BSD]]-based [[macOS]] due to code swapping the slash and colon to try to preserve this usage. In most systems it is often difficult to put a colon in a filename as the shell interprets it for other purposes. [[CP/M]] and early versions of [[MSDOS]] required the colon after the names of devices, such as {{code|CON:}} though this gradually disappeared except for disks (where it had to be between the disk name and the required [[path (computing)|path representation]] of the file as in <code>C:\Windows\</code>). This then migrated to use in [[Uniform Resource Locator|URLs]].{{Ref RFC|3986|repeat=yes}} ===Text markup=== {{Unreferenced section|date=April 2022}} It is often used as a single post-fix [[delimiter]], signifying a token keyword had immediately preceded it or the transition from one mode of character string interpretation to another related mode. Some applications, such as the widely used [[MediaWiki]], utilize the colon as both a pre-fix and post-fix delimiter. <!-- Could work more wikimarkup into that as an example. --><!-- What is this trying to say? --> In [[wiki markup]], the colon is often used to indent text. Common usage includes separating or marking comments in a discussion as replies, or to distinguish certain parts of a text. {{markup |<nowiki> Normal text. :Indented text by the means of a colon. ::The gap increases with colon number. </nowiki> | Normal text. :Indented text by the means of a colon. ::The gap increases with colon number. }} In human-readable text messages, a colon, or multiple colons, is sometimes used to denote an action (similar to how [[asterisk]]s are used){{Original research inline|date=May 2012}} or to emote (for example, in [[vBulletin]]). In the action denotation usage it has the inverse function of quotation marks, denoting actions where unmarked text is assumed to be dialogue. For example: :'''Tom:''' Pluto is so small; it should not be considered a planet. It is tiny! :'''Mark:''' Oh really? ::drops Pluto on Tom's head:: Still think it's small now? Colons may also be used for sounds, e.g., ::click::, though sounds can also be denoted by asterisks or other punctuation marks. Colons can also be used to represent eyes in [[emoticon]]s.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)