Semicolon#Programming
{{Short description|Punctuation mark (;)}}
{{hatgrp|{{Redirect-synonym|;|Greek question mark}}
{{For-multi|the music album|Semicolon (EP){{!}}Semicolon (EP)|use on Wikipedia|Wikipedia:Semicolon}}}}
{{Infobox punctuation mark|mark=
|variant1=؛|caption1=Arabic semicolon
|variant2=፤|caption2=Ethiopic semicolon
|variant3=꛶|caption3=Bamum semicolon
|unicode={{unichar|003B|SEMICOLON|html=}}
}}
The semicolon {{char|;}} (or semi-colon{{cite web |title=Learning English |department=BBC World Service |website=bbc.co.uk |publisher=British Broadcasting Corporation |url=http://www.bbc.co.uk/worldservice/learningenglish/grammar/learnit/learnitv55.shtml |access-date=2014-05-08 |archive-date=2015-03-23 |archive-url=https://web.archive.org/web/20150323053952/http://www.bbc.co.uk/worldservice/learningenglish/grammar/learnit/learnitv55.shtml |url-status=live }}) is a symbol commonly used as orthographic punctuation. In the English language, a semicolon is most commonly used to link (in a single sentence) two independent clauses that are closely related in thought, such as when restating the preceding idea with a different expression. When a semicolon joins two or more ideas in one sentence, those ideas are then given equal rank.{{Cite web |title=Using semicolons |website=The Writing Center |lang=en-US |url=https://writing.wisc.edu/handbook/grammarpunct/semicolons/ |access-date=2020-11-08 |quote=A semicolon is most commonly used to link (in a single sentence) two independent clauses that are closely related in thought. When a semicolon is used to join two or more ideas (parts) in a sentence, those ideas are then given equal position or rank. |archive-date=2020-11-11 |archive-url=https://web.archive.org/web/20201111165409/https://writing.wisc.edu/handbook/grammarpunct/semicolons/ |url-status=live }} Semicolons can also be used in place of commas to separate items in a list, particularly when the elements of the list themselves have embedded commas.{{cite web | title=Learning English grammar: How to correctly use a semicolon | website=Scribendi.com |url=http://www.grammarcamp.com/learning-english-grammar-2/ | access-date=30 July 2014 | url-status=dead | archive-url=https://web.archive.org/web/20140808053114/http://www.grammarcamp.com/learning-english-grammar-2/ | archive-date=8 August 2014 }}
The semicolon is one of the least understood of the standard marks, and is not frequently used by many English speakers.{{cite web |title=For Love of the Semicolon – Insights to English |url=https://www.insightstoenglish.com/language-illuminated/semicolons |access-date=2020-11-09 |website=Insights to English |lang=en-US |department=Language Illuminated |archive-date=2020-11-10 |archive-url=https://web.archive.org/web/20201110051440/https://www.insightstoenglish.com/language-illuminated/semicolons/ |url-status=live }}
In the QWERTY keyboard layout, the semicolon resides in the unshifted homerow beneath the little finger of the right hand and has become widely used in programming languages as a statement separator or terminator.
History
In 1496,{{efn|Note: this is February 1495 by the Venetian calendar, or MVD in Roman numerals. Several texts mention the earliest printing year as 1494 without any attested source. This may be due to a misunderstanding: the text De Aetna itself recalls a conversation from September 1494 (Gregorian calendar); the earliest attested printing occurred in February 1496 (Gregorian calendar).{{r|Kidwell}}{{cite web |last1=Nuvoloni |first1=Laura |title=Pietro Bembo and the University Library copy of the De Aetna of 1496 |url=https://inc-blog.lib.cam.ac.uk/?p=2143 |date=2012-08-09 |publisher=Cambridge University Library |access-date=2022-10-26 |archive-date=2022-10-26 |archive-url=https://web.archive.org/web/20221026124035/https://inc-blog.lib.cam.ac.uk/?p=2143 |url-status=live }} See also the colophon at the end of the book: impressum venetiis in aedibus aldi romani mense februario anno M.V.D. ("printed in Venice at the house of Aldo in February 1495
|last=Parkes |first=Malcolm Beckwith |author-link=Malcolm Parkes |year=1993 | title=Pause and Effect: An Introduction to the History of Punctuation in the West |publisher=University of California Press
|isbn=0-520-07941-8}} |page=49}}
In 1561, Manuzio's grandson, also called Aldo Manuzio, explains the semicolon's use with several examples in Orthographiae ratio. In particular, Manuzio motivates the need for punctuation (interpungō) to divide (distinguō) sentences and thereby make them understandable. The comma, semicolon, colon, and period are seen as steps, ascending from low to high; the semicolon thereby being an intermediate value between the comma {{char|,}} and colon {{char|:}}. Here are four examples used in the book to illustrate this:{{cite book |last1=Aldo |first1=Manuzio |author-link=Aldus Manutius the Younger |title=Orthographiae ratio |date=1561 |language=Latin |location=Venice |page=[https://lib.ugent.be/europeana/900000017204?pg=PA52 52] |url=https://lib.ugent.be/catalog/rug01:001753275 |access-date=2022-10-25 |archive-date=2022-10-25 |archive-url=https://web.archive.org/web/20221025210425/https://lib.ugent.be/catalog/rug01:001753275 |url-status=live }}{{r|parkes|page=49}}
Publica, privata; sacra, profana; tua, aliena.{{efn|Manuzio notes: using just commas here is not sufficient, and using a colon instead of a semicolon would slow down the sentence too much.{{r|manuzio}}}}
Public, private; sacred, profane; thine, another's.
Ratio docet, si adversa fortuna sit, nimium dolendum non esse; si secunda, moderate laetandum.{{efn|Manuzio notes: if there were a comma after non esse, then the sentence would be as if rushed forward head-first; however, since the sentence is in two parts, it must stop for a little bit before continuing. Moreover, he says, we can't use a colon, since Ratio docet governs both parts of the sentence equally, not just the first.{{r|manuzio}}}}
Reason teaches, if fortune is adverse, not to complain too much; if favorable, to rejoice in moderation.
Tu, quid divitiae valeant, libenter spectas; quid virtus, non item.{{efn|Manuzio shows another example of where we need a semicolon instead of a colon; Tu and spectas govern both parts of the sentence equally.{{r|manuzio}}}}
You, what riches are worth, gladly consider; what virtue (is worth), not so much.
Etsi ea perturbatio est omnium rerum, ut suae quemque fortunae maxime paeniteat; nemoque sit, quin ubivis, quam ibi, ubi est, esse malit: tamen mihi dubium non est, quin hoc tempore bono viro, Romae esse, miserrimum sit.{{efn|Manuzio notes, this passage is taken from Cicero's letter to Torquatus (see Epistulae ad Familiares). He uses this example, he says, to show situations where both the semicolon and colon are needed for division.{{r|manuzio}}}}
Although it is a universal confusion of affairs(,) such that everyone regrets their own fate above all others; and there is no one, who would not rather anywhere else in the world, than there, where he is, prefer to be: yet I have no doubt, at the present time for an honest man, to be in Rome, is the worst form of misery.
Around 1580, Henry Denham starts using the semicolon "with propriety" for English texts, and more widespread usage picks up in the next decades.{{r|parkes|p=52}}{{cite book |last1=Ames |first1=Joseph |last2=Herbert |first2=William |title=Typographical Antiquities: Or an Historical Account of the Origin and Progress of Printing in Great Britain and Ireland: Containing Memoirs of Our Ancient Printers, and a Register of Books Printed by Them, from the Year MCCCCLXXI to the Year MDC. |date=1786 |url=https://books.google.com/books?id=k-hWAAAAcAAJ |page=[https://books.google.com/books?id=k-hWAAAAcAAJ&pg=PA942 942] |access-date=2022-10-23 |archive-date=2022-10-23 |archive-url=https://web.archive.org/web/20221023004138/https://books.google.com/books?id=k-hWAAAAcAAJ |url-status=live }}
Around 1640,{{efn|According to the British Library, the book was "written in 1623 and lost in a fire, but rewritten and published after Jonson's death".{{cite web |title=Ben Jonson's The English Grammar |url=https://www.bl.uk/collection-items/ben-jonsons-the-english-grammar |website=British Library |access-date=2022-10-22 |archive-date=2022-10-23 |archive-url=https://web.archive.org/web/20221023004139/https://www.bl.uk/collection-items/ben-jonsons-the-english-grammar |url-status=live }}}} in Ben Jonson's book The English Grammar, the character {{char|;}} is described as "somewhat a longer breath" compared to the comma. The aim of the breathing, according to Jonson, is to aid understanding.{{cite book |last1=Jonson |first1=Ben |author-link=Ben Jonson |title=The Works of Ben Jonson, which were Formerly Printed in Two Volumes, are Now Reprinted in One. (3rd folio) |date=1692 |publisher=Printed by Thomas Hodgkin, for H[enry] Herringman, E. Brewster, T. Bassett, R[ichard] Chiswell, M. Wotton, G. Conyers |location=London |page=[https://archive.org/details/workesofbenjamin03jons/page/690 690] |url=https://archive.org/details/workesofbenjamin03jons}}{{efn|The 1640 version of the text calls the character {{char|;}} a sub-distinction,{{cite book |last1=Jonson |first1=Ben |author-link=Ben Jonson |title=The English Grammar |date=1640 |page=83 |url=https://books.google.com/books?id=nVxRAAAAcAAJ}} the 1692 version names it a semicolon.{{r|jonson1692}} Moreover, the order of the comma and semicolon seem to have been reversed by mistake in the 1640 version. Thus, the comma is mistakenly described as having a longer breathe than the semicolon.{{r|jonson 1640}}}}
In 1644, in Richard Hodges' The English Primrose, it is written:{{cite book |last1=Hodges |first1=Richard |title=The English Primrose, 1644 |date=1969 |publisher=Menston, (Yorks.) Scolar P. |isbn=978-0-85417-116-3 |page=[https://archive.org/details/englishprimrose100hodg/page/n109 N3] |url=https://archive.org/details/englishprimrose100hodg}}
At a comma, stop a little;
[...]
At a semi-colon, somewhat more;
[...]
At a colon, a little more than the former;
[...]
At a period, make a full stop;
In 1762, in Robert Lowth's A Short Introduction to English Grammar, a parallel is drawn between punctuation marks and rest in music:{{cite book |last1=Lowth |first1=Robert |title=A Short Introduction to English Grammar: with Critical Notes ... |date=1762 |publisher=J. Hughs |location=London |page=[https://books.google.com/books?id=dJSangEACAAJ&pg=158 158] |url=https://books.google.com/books?id=dJSangEACAAJ&pg=158 |language=en |access-date=2022-10-24 |archive-date=2023-04-25 |archive-url=https://web.archive.org/web/20230425204104/https://books.google.com/books?id=dJSangEACAAJ&pg=158 |url-status=live }}
The Period is a pause in quantity or duration double of the Colon; the Colon is double of the Semicolon; and the Semicolon is double of the Comma. So that they are in the same proportion to one another as the Sembrief, the Minim, the Crotchet, and the Quaver, in Music.
In 1798, in Lindley Murray's English Grammar, the semicolon is introduced as follows:{{cite book |last1=Murray |first1=Lindley |author-link=Lindley Murray |title=English Grammar, Adapted to Different Classes of Learners. With an Appendix, Containing Rules and Observations, For Assisting The More Advanced Students to Write With Perspicuity and Accuracy. |date=1798 |edition=4th |location=London |publisher=Wilson, Spence, and Mawman |pages=[https://books.google.com/books?id=yF1iAAAAcAAJ&pg=PA226 226–227] |chapter-url=https://books.google.com/books?id=yF1iAAAAcAAJ&pg=PA226 |chapter=Part IV: Of Punctuation. Chapter II: Of the Semicolon |access-date=2022-10-24 |archive-date=2022-10-24 |archive-url=https://web.archive.org/web/20221024165037/https://books.google.com/books?id=yF1iAAAAcAAJ&pg=PA226 |url-status=live }}
The Semicolon is used for dividing a compound sentence into two or more parts, not so closely connected as those which are separated by a comma, nor yet so little dependent on each other, as those which are distinguished by a colon.
The semicolon is sometimes used, when the preceding member of the sentence does not of itself give a complete sense, but depends on the following clause; and sometimes when the sense of that member would be complete without the concluding one; as in the following instances.
Natural languages
= English =
Although terminal marks (i.e. full stops, exclamation marks, and question marks) indicate the end of a sentence, the comma, semicolon, and colon are normally inside sentences, making them secondary boundary marks. In modern English orthography, the semicolon falls between terminal marks and the comma; its strength is equal to that of the colon.The Cambridge Grammar of the English Language, Chapter 19, § 7.
The most common use of the semicolon is to join two independent clauses without using a conjunction such as "and".{{Cite web|url = https://www.grammarly.com/blog/semicolon/|title = Semicolon|date = 7 January 2016|access-date = 20 July 2021|archive-date = 20 July 2021|archive-url = https://web.archive.org/web/20210720190839/https://www.grammarly.com/blog/semicolon/|url-status = live}} Semicolons are followed by a lower case letter, unless that letter would ordinarily be capitalised mid-sentence (e.g., the word "I", acronyms/initialisms, or proper nouns). In older English printed texts, colons and semicolons are offset from the preceding word by a non-breaking space, a convention still current in modern continental French texts. Ideally, the space is less wide than the inter-word spaces. Some guides recommend separation by a hair space.{{cite book|url=https://archive.org/details/onebookfivewaysp00asso|url-access=registration|title=One book/five ways : the publishing procedures of five university presses|date=1978|location=USA|publisher=The Association of American University Presses|via=Internet Archive|page=[https://archive.org/details/onebookfivewaysp00asso/page/276 276]|quote=COLONS AND SEMI-COLONS Should be preceded by a hair space only.}} Modern style guides recommend no space before them and one space after. They also typically recommend placing semicolons outside ending quotation marks, although this was not always the case. For example, the first edition of The Chicago Manual of Style (1906) recommended placing the semicolon inside ending quotation marks.{{cite web|url=https://glyphic.design/chicago-manual-of-style-16th-edition-2/|title=Review|first=Dave|last=Spencer|date=15 February 2011|website=glyphic.design|access-date=28 August 2019|type=review of The Chicago Manual of Style, 16th edition|archive-date=28 August 2019|archive-url=https://web.archive.org/web/20190828072842/https://glyphic.design/chicago-manual-of-style-16th-edition-2/|url-status=live}}
Uses of the semicolon in English include:
- {{anchor|Super comma}}Between items in a series or listing when the items contain internal punctuation, especially parenthetic commas, where the semicolons function as the serial commas for the series or listing. The semicolon divides the items on the list from each other, to avoid having a jumble of commas with differing functions which could cause confusion for the reader. This is sometimes called the "super comma" function of the semicolon:
- The people present were Jamie, a man from New Zealand; John, the milkman's son; and George, a gaunt kind of man with no friends.
- Several fast food restaurants can be found within the following cities: London, England; Paris, France; Dublin, Ireland; and Madrid, Spain.
- Here are three examples of familiar sequences: one, two, and three; a, b, and c; first, second, and third.
- (Fig. 8; see also plates in Harley 1941, 1950; Schwab 1947).
- Between closely related independent clauses not conjoined with a coordinating conjunction, when the two clauses are balanced, opposed or contradictory:{{cite web|url=https://owl.english.purdue.edu/owl/resource/607/04/|title=Purdue OWL: Commas|work=purdue.edu|access-date=2016-06-20|archive-date=2016-08-18|archive-url=https://web.archive.org/web/20160818200451/https://owl.english.purdue.edu/owl/resource/607/04/|url-status=live}}
- My wife said she would like tea; coffee would have been my choice.
- I went to the basketball court; it was closed for cleaning.
- I told Kate she's running for the hills; she knew I was joking.
- In rare instances, when a comma replaces a period (full stop) in a quotation, or when a quotation otherwise links two independent sentences:
- "I have no use for this," he said; "you are welcome to it."
- "Is this your book?" she asked; "I found it on the floor."
In a list or sequence, if even one item needs its own internal comma, use of the semicolon as the separator throughout that list is justified, as shown by this example from the California Penal Code:{{Quote |text=A crime or public offense is an act committed or omitted in violation of a law forbidding or commanding it, and to which is annexed, upon conviction, either of the following punishments:
- Death;
- Imprisonment;
- Fine;
- Removal from office; or,
- Disqualification to hold and enjoy any office of honor, trust, or profit in this State.{{cite web|url=http://leginfo.legislature.ca.gov/faces/codes_displaySection.xhtml?lawCode=PEN§ionNum=15.|publisher=California Office of Legislative Counsel|title=California Penal Code § 15|date=1872|access-date=23 September 2020|archive-date=3 October 2020|archive-url=https://web.archive.org/web/20201003042235/http://leginfo.legislature.ca.gov/faces/codes_displaySection.xhtml?lawCode=PEN§ionNum=15.|url-status=live}}}}
= Arabic =
In Arabic, the semicolon is called fasila manqoota ({{langx|ar|فاصلة منقوطة|links=no}}) which means literally "a dotted comma", and is written inverted {{char|؛}}. In Arabic, the semicolon has several uses:
- It can be used between two phrases, in which the first phrase causes the second.
- Example: "He played a lot; so, his clothes became dirty". ({{langx|ar|لَعِبَ كَثِيرًا؛ فَٱتَّسَخَتْ مَلَابِسُهُ.|links=no}})
- It can be used between two phrases, where the second is a reason for the first.
- Example: "Your sister did not get high marks; she didn't study". ({{langx|ar|لم تحقق أختك درجات عالية؛ لأنها لم تدرس .|links=no}})
= Greek and Church Slavonic =
{{Main|Question mark#Greek question mark}}
In Greek and Church Slavonic, the question mark looks exactly the way a semicolon looks in English, similar to the question mark used in Latin.{{cite book |author=Paine, Stephen W. |year=1961 |title=Beginning Greek: A functional approach |publisher=Oxford University Press |page=13}}{{harvnb|Truss|2004|page=111}} To indicate a long pause or to separate sections that already contain commas (the semicolon's purposes in English), Greek uses, but extremely rarely, the interpunct {{char|·}} ({{langx|el|{{math|άνω τελεία}}|translit=áno teleía|translation=upper dot|size=100%|links=no}}).
Church Slavonic with a question mark: {{math|гдѣ єсть рождeйсѧ царь їудeйскій;}} (Where is the one who is born king of the Jews? – Matthew 2:1)
Greek with a question mark: {{math|Τι είναι μια διασύνδεση;}} (What is a connection?)
= French =
In French, a semicolon (point-virgule, literally "dot-comma") is a separation between two full sentences, used where neither a colon nor a comma would be appropriate. The phrase following a semicolon has to be an independent clause, related to the previous one but not explaining it. (When the second clause explains the first one, French consistently uses a colon.)
The dash character is used in French writing too, but not as widely as the semicolon. Usage of these devices (semicolon and dash) varies from author to author.
Literature
{{Quote box
| quote = Just as there are writers who worship the semicolon, there are other high stylists who dismiss it — who label it, if you please, middle-class.
| source = Lynne Truss, Eats, Shoots, and Leaves{{sfn|Truss|2004|page=107}}
| width = 27%
| align = right
| style = padding:8px;
}}
Some authors have avoided and rejected the use of the semicolon throughout their works. Lynne Truss stated:
{{Quote|text=Samuel Beckett spliced his way merrily through such novels as Molloy and Malone Dies, thumbing his nose at the semicolon all the way. James Joyce preferred the colon, as he thought it was more authentically classical. P. G. Wodehouse did an effortlessly marvelous job without it, George Orwell tried to avoid the semicolon completely in Coming Up for Air (1939), Martin Amis included just one semicolon in Money (1984), and Umberto Eco was congratulated by an academic reader for using zero semicolons in The Name of the Rose (1983).{{sfn|Truss|2004|pages=88, 108–109}}}}
In response to Truss, Ben Macintyre, a columnist in The Times, wrote:
{{Quote|text=Americans have long regarded the semi-colon with suspicion, as a genteel, self-conscious, neither-one-thing-nor-the other sort of punctuation mark, with neither the butchness of a full colon nor the flighty promiscuity of the comma. Hemingway, Chandler, and Stephen King wouldn't be seen dead in a ditch with a semi-colon (though Truman Capote might). Real men, goes the unwritten rule of American punctuation, don't use semi-colons.{{cite news |last=MacIntyre |first=Ben |date=19 November 2005 |title=Is it worth busting your (Lynne) truss over a comma with a hat on? |newspaper=The Times |place=London, UK |url=http://entertainment.timesonline.co.uk/tol/arts_and_entertainment/books/article591397.ece |access-date= }}{{dead link|date=September 2024|bot=medic}}{{cbignore|bot=medic}}}}
Semicolon use in British fiction has declined by 25% from 1991 to 2021.{{cite web |author=Lloyd, Will |date=24 November 2021 |title=The melancholy decline of the semicolon |website=UnHerd |url=https://unherd.com/thepost/the-melancholy-decline-of-the-semicolon/ |access-date=27 November 2021 |archive-date=27 November 2021 |archive-url=https://web.archive.org/web/20211127153315/https://unherd.com/thepost/the-melancholy-decline-of-the-semicolon/ |url-status=live }}
Character encoding
In Unicode, the semicolon is encoded at {{unichar|003B|semicolon}}; this is the same value as it had in ASCII and ISO 8859-1.
Unicode contains encoding for several other semicolon or semicolon-like characters:
- {{unichar|037E|GREEK QUESTION MARK|nlink=Greek question mark}}
- {{unichar|061B|Arabic semicolon}} – Arabic script
- {{unichar|1364|Ethiopic semicolon}} – Geʽez script
- {{unichar|204F|Reversed semicolon}} – used in old writing systems, such as Hungarian Runic{{cite web|url=http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3664.pdf|title=Proposal for encoding generic punctuation used with the Hungarian Runic script|first1=Michael|last1=Everson|first2=André Szabolcs|last2=Szelp|date=2009-07-22|access-date=2014-03-12|archive-date=2014-02-24|archive-url=https://web.archive.org/web/20140224062330/http://std.dkuug.dk/jtc1/sc2/wg2/docs/n3664.pdf|url-status=live}} and Sindhi language
- {{unichar|236E|APL FUNCTIONAL SYMBOL SEMICOLON UNDERBAR}} – used in the APL programming language
- {{unichar|2E35|TURNED SEMICOLON}} – "indicates sudden glottal closure" in the International Phonetic Alphabet
- {{unichar|A6F6|Bamum semicolon}} – Bamum script
- {{unichar|FE14|PRESENTATION FORM FOR VERTICAL SEMICOLON}} – determines orientation when wide-character scripts are written vertically instead of horizontally
- {{unichar|FE54|SMALL SEMICOLON}} – Small Form Variants are for compatibility with Chinese National Standard CNS 11643
- {{unichar|FF1B|Fullwidth semicolon}} – for use in wide-character scripts such as kanji
- {{unichar|E003B|TAG SEMICOLON}} – deprecated tags block
Computing
{{See also|Colon (punctuation)#Computing}}
= Programming =
In computer programming, the semicolon is often used to separate multiple statements (for example, in Perl,{{cite web |url=https://perldoc.perl.org/perlsyn#Simple-Statements |title=perlsyn - Perl syntax |type=subtitle: Simple Statements |website=Perldoc Browser |date=28 May 2022 |archive-date=12 November 2022 |archive-url=https://web.archive.org/web/20221112015442/https://perldoc.perl.org/perlsyn#Simple-Statements |url-status=live}} Pascal,{{cite web |url=https://wiki.freepascal.org/; |website=Free Pascal and Lazarus Wiki |date=4 July 2021 |archive-date=22 October 2021 |archive-url=https://web.archive.org/web/20211022160946/https://wiki.freepascal.org/; |url-status=live|title=Free Pascal wiki }} and SQL;{{cite web |url=https://www.postgresql.org/docs/current/sql-syntax-lexical.html |title=Documentation: 15: 4.1. Lexical Structure |website=PostgreSQL |access-date=28 November 2022 |archive-date=21 October 2022 |archive-url=https://web.archive.org/web/20221021073901/https://www.postgresql.org/docs/current/sql-syntax-lexical.html |url-status=live}} see Pascal: Semicolons as statement separators). In other languages, semicolons are called terminators{{cite web
| access-date = 2011-07-29
| first = H.
| last = Mössenböck
| location = Linz
| page = 34
| publisher = University of Linz
| title = Introduction to C# – The new language for Microsoft .NET
| type = subtitle: Statements
| quote = Empty statement: ; // ; is a terminator, not a separator
| url = http://ssw.jku.at/Teaching/Lectures/CSharp/Tutorial/Part1.pdf
| archive-date = 2011-09-29
| archive-url = https://web.archive.org/web/20110929062908/http://ssw.jku.at/Teaching/Lectures/CSharp/Tutorial/Part1.pdf
| url-status = live
}}. and are required after every statement (such as in PL/I,{{cite book
| access-date = 2021-01-04
| page = 14
| publisher = IBM
| title = IBM System/360 Operating System PL/I Language Specifications
| quote = A statement, which is a string of characters, is always terminated by the special character, semicolon.
| id = C28-6571-3
| url = http://bitsavers.org/pdf/ibm/360/pli/C28-6571-3_PL_I_Language_Specifications_Jul66.pdf
| date = July 1966
| archive-date = 2021-11-09
| archive-url = https://web.archive.org/web/20211109194134/http://bitsavers.org/pdf/ibm/360/pli/C28-6571-3_PL_I_Language_Specifications_Jul66.pdf
| url-status = live
}} Java,{{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}} and the C{{cite web |url=https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf |title=ISO/IEC 9899:TC3 — Programming languages — C |date=7 September 2007 |author=ISO/IEC JTC1/SC22/WG14 |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 |page=132}} family). Today semicolons as terminators has largely won out, but this was a divisive issue in programming languages from the 1960s into the 1980s.{{cite book
| title = Object-Oriented Software Construction
| first = Bertrand
| last = Meyer
| author-link = Bertrand Meyer
| page = [https://books.google.com/books?ei=7eZ7VKGWM4friQK6xICIAg&id=xls_AQAAIAAJ&dq=semicolon 897]
| edition = Second
| year = 1997
| isbn = 978-0-13-629155-8
| title-link = Object-Oriented Software Construction
}} An influential and frequently cited study in this debate was {{harvtxt|Gannon|Horning|1975}}, which concluded strongly in favor of semicolon as a terminator: "The most important [result] was that having a semicolon as a statement terminator was better than having a semicolon as a statement separator."{{cite book
| title = Software Metrics: An Analysis and Evaluation
| first1 = Alan J
| last1 = Perlis
| first2 = Frederick
| last2 = Sayward
| first3 = Mary
| last3 = Shaw
| page = [https://books.google.com/books?id=9dNw2_RYNLYC&q=semicolon 324]
| year = 1981
| isbn = 978-0-26-216083-4
| publisher = MIT Press
}} The study has been criticized as flawed by proponents of semicolon as a separator,{{cite tech report
| title = Principles of language design and evolution
| url = http://se.ethz.ch/~meyer/publications/hoare/evolution.pdf
| first = Bertrand
| last = Meyer
| author-link = Bertrand Meyer
| url-status = live
| archive-url = https://web.archive.org/web/20120109190541/http://se.ethz.ch/~meyer/publications/hoare/evolution.pdf
| archive-date = 9 January 2012
}} due to participants being familiar with a semicolon-as-terminator language and unrealistically strict grammar. Nevertheless, the debate ended in favor of semicolon as terminator. Therefore, semicolon provides structure to the programming language.
Semicolons are optional in a number of languages, including BCPL,{{cite web |url=https://www.bell-labs.com/usr/dmr/www/bcpl.pdf |title=The BCPL Reference Manual |date=21 July 1967 |website=Dennis M Ritchie's personal page |first=Martin |last=Richards |archive-date=11 June 2015 |archive-url=https://web.archive.org/web/20150611114538/https://www.bell-labs.com/usr/dmr/www/bcpl.pdf |url-status=live}} Python,{{cite web |url=https://docs.python.org/3/reference/simple_stmts.html |title=The Python Language Reference - 7. Simple statements |date=22 January 2016 |publisher=Python Software Foundation |archive-date=7 October 2017 |archive-url=https://archive.today/20171007042643/https://docs.python.org/3/reference/simple_stmts.html |url-status=live}} R,{{cite web |url=https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Control-structures |title=R Language Definition |type=subtitle: 3.2 Control structures |website=The Comprehensive R Archive Network |date=31 October 2022 |archive-date=21 November 2022 |archive-url=https://web.archive.org/web/20221121131338/https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Control-structures |url-status=live}} Eiffel,{{cite web |url=http://www.gobosoft.com/eiffel/syntax/ |title=Eiffel: The Syntax |date=2 September 2019 |website=Gobo Eiffel Project |archive-date=8 August 2022 |archive-url=https://web.archive.org/web/20220808043456/http://gobosoft.com/eiffel/syntax/ |url-status=live}} and Go,{{cite web |url=https://go.dev/ref/spec#Tokens |title=The Go Programming Language Specification |type=subtitle: Tokens |website=The Go Programming Language |date=29 June 2022 |archive-date=27 November 2022 |archive-url=https://web.archive.org/web/20221127233150/https://go.dev/ref/spec#Tokens |url-status=live}} meaning that they are part of the formal grammar for the language but can be inferred in many or all contexts (e.g., by end of line that ends a statement, as in Go and R). As languages can be designed without them, semicolons are considered an unnecessary nuisance by some.
The use of semicolons in control-flow structures and blocks of code is varied – semicolons are generally omitted after a closing brace, but included for a single statement branch of a control structure (the "then" clause), except in Pascal, where a semicolon terminates the entire if...then...else clause (to avoid dangling else) and thus is not allowed between a "then" and the corresponding "else", as this causes unnesting.
This use originates with ALGOL 60{{cite web |url=https://www.masswerk.at/algol60/report.htm#4 |title=Revised Report on the Algorithmic Language Algol 60 |type=subtitle: 4. Statements |date=1 January 1963 |website=mass:werk |archive-date=25 June 2007 |archive-url=https://archive.today/20070625171638/http://www.masswerk.at/algol60/report.htm |url-status=live}} and falls between the comma {{char|,}}{{snd}} used as a list separator{{snd}} and the period/full stop {{char|.}}{{snd}} used to mark the end of the program. The semicolon, as a mark separating statements, corresponds to the ordinary English usage of separating independent clauses and gives the entire program the gross syntax of a single ordinary sentence. Of these other characters, whereas commas have continued to be widely used in programming for lists (and rare other uses, such as the comma operator that separates expressions in C), they are rarely used otherwise, and the period as the end of the program has fallen out of use. The last major use of the comma, semicolon, and period hierarchy is in Erlang (1986), where commas separate expressions; semicolons separate clauses, both for control flow and for function clauses; and periods terminate statements, such as function definitions or module attributes, not the entire program. Drawbacks of having multiple different separators or terminators (compared to a single terminator and single grouping, as in semicolon-and-braces) include mental overhead in selecting punctuation, and overhead in rearranging code, as this requires not only moving lines around, but also updating the punctuation.{{cite web |url=http://damienkatz.net/2008/03/what_sucks_abou.html |title=What Sucks About Erlang |last=Katz |first=Damien |date=9 March 2008 |archive-date=14 June 2013 |archive-url=https://archive.today/20130614160612/http://damienkatz.net/2008/03/what_sucks_abou.html |url-status=dead}}
In some cases the distinction between a separator and a terminator is strong, such as early versions of Pascal, where a final semicolon yields a syntax error. In other cases a final semicolon is treated either as optional syntax or as being followed by a null statement, which is either ignored or treated as a NOP (no operation or null command); compare trailing commas in lists. In some cases a blank statement is allowed, allowing a sequence of semicolons or the use of a semicolon by itself as the body of a control-flow structure. For example, a blank statement (a semicolon by itself) stands for a NOP in C/C++, which is useful in busy waiting synchronization loops.
APL uses semicolons to separate declarations of local variables{{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}}{{Rp|p=61}} and to separate axes when indexing multidimensional arrays, for example, matrix[2;3]
.{{Rp|pp=220,275}}
Other languages (for instance, some assembly languages{{cite web |url=https://www.nasm.us/xdoc/2.15.05/html/nasmdoc3.html |title=Chapter 3: The NASM Language |date=28 August 2020 |website=NASM - The Netwide Assembler |archive-date=25 October 2022 |archive-url=https://web.archive.org/web/20221025180850/https://www.nasm.us/xdoc/2.15.05/html/nasmdoc3.html |url-status=live}} and LISP{{cite web |url=http://www.lispworks.com/documentation/HyperSpec/Body/02_dd.htm |title=Common Lisp HyperSpec |type=subtitle: Section 2.4.4 |publisher=LispWorks |archive-date=18 June 2013 |archive-url=https://archive.today/20130618201107/http://www.lispworks.com/documentation/HyperSpec/Body/02_dd.htm |url-status=live}} dialects, CONFIG.SYS and INI files) use semicolons to mark the beginning of comments.
Example C code:
int main() {
int x, y;
x = 1; y = 2;
printf("X + Y = %d", x + y);
return 0;
}
Or in JavaScript:
var x = 1; var y = 2;
alert("X + Y = " + (x + y));
Conventionally, in many languages, each statement is written on a separate line, but this is not typically a requirement of the language. In the above examples, two statements are placed on the same line; this is legal, because the semicolon separates the two statements. Thus programming languages like Java, the C family, Javascript etc. use semicolons to obtain a proper structure in the respective languages.
= Data =
The semicolon is often used to separate elements of a string of text. For example, multiple e-mail addresses in the "To" field in some e-mail clients have to be delimited by a semicolon.
In Microsoft Excel, the semicolon is used as a list separator, especially in cases where the decimal separator is a comma, such as 0,32; 3,14; 4,50
, instead of 0.32, 3.14, 4.50
.
In Lua,{{cite web |url=https://www.lua.org/manual/5.4/manual.html#3.4.9 |title=Lua 5.4 Reference Manual |at=3.4.9 – Table Constructors |date=13 January 2022 |archive-date=1 October 2022 |archive-url=https://archive.today/20221001132750/https://www.lua.org/manual/5.4/manual.html |url-status=live}} semicolons or commas can be used to separate table elements.
In MATLAB and GNU Octave,{{cite web |url=https://docs.octave.org/interpreter/Simple-Examples.html#Creating-a-Matrix |title=GNU Octave (version 7.3.0) |at=1.2.2 Creating a Matrix |date=2 November 2022 |archive-date=28 November 2022 |archive-url=https://web.archive.org/web/20221128221701/https://docs.octave.org/interpreter/Simple-Examples.html#Creating-a-Matrix |url-status=live |publisher=GNU Octave |access-date=28 November 2022 }} the semicolon can be used as a row separator when defining a vector or matrix (whereas a comma separates the columns within a row of a vector or matrix) or to execute a command silently, without displaying the resulting output value in the console.
In HTML, a semicolon is used to terminate a character entity reference, either named or numeric.{{cite web |url=https://developer.mozilla.org/en-US/docs/Glossary/Entity |title=Entity |date=21 September 2022 |website=MDN |archive-date=25 November 2022 |archive-url=https://web.archive.org/web/20221125232110/https://developer.mozilla.org/en-US/docs/Glossary/Entity |url-status=live}} The declarations of a style attribute in Cascading Style Sheets (CSS) are separated and terminated with semicolons.{{cite web |url=https://www.w3schools.com/css/css_syntax.asp |title=CSS Syntax |website=W3Schools |archive-date=25 February 2021 |archive-url=https://archive.today/20210225234210/https://www.w3schools.com/css/css_syntax.asp |url-status=live}}
The file system of RSX-11 and OpenVMS, Files-11, uses semicolons to indicate a file's version number.{{cite web |url=http://www.alticore.eu/cgi-bin/conan?key=Ext_File_Specs~Using~File_Specification_Differences&explode=yes&title=VMS%20Help |title=Ext File Specs, Using File Specification Differences |website=VMS Help |publisher=Consiglio Nazionale delle Ricerche |archive-date=7 August 2020 |archive-url=https://web.archive.org/web/20200807022056/http://www.alticore.eu/cgi-bin/conan?key=Ext_File_Specs~Using~File_Specification_Differences&explode=yes&title=VMS%20Help |url-status=dead}} The semicolon is permitted in long filenames in the Microsoft Windows file systems NTFS and VFAT, but not in its short names.{{cite web |url=https://docs.microsoft.com/en-us/windows/win32/msi/filename |title=Filename - Win32 Apps |website=Microsoft Learn |publisher=Microsoft |archive-date=28 August 2019 |archive-url=https://web.archive.org/web/20190828072842/https://docs.microsoft.com/en-us/windows/win32/msi/filename |url-status=live |date=31 May 2018}}
In some delimiter-separated values file formats, the semicolon is used as the separator character, as an alternative to comma-separated values.
Mathematics
In mathematical derivations, a semicolon is used to separate expressions in a sequence, similar to its use in spoken English, and may be considered either punctuation for the mathematical expressions, or as punctuation for the words spoken when reading the expressions. For example, completing the square:
::
::
::
::
In the argument list of a mathematical function a semicolon may be used to separate variables from fixed parameters.{{citation needed|date=December 2014}}
In differential geometry and tensor analysis a semicolon preceding an index is used to indicate the covariant derivative of a function with respect to the coordinate associated with that index.
In the calculus of relations, the semicolon is used in infix notation for the composition of relations:
In piecewise functions, a semicolon or comma may follow the subfunction or subdomain; the or can be omitted, in which case it seems replaced by the semicolon or comma.{{Cite web |last=Weisstein |first=Eric W. |title=Piecewise Function |url=https://mathworld.wolfram.com/PiecewiseFunction.html |access-date=2024-07-20 |website=mathworld.wolfram.com |language=en}}
The {{mono|1=;}} Humphrey point is sometimes used as the "decimal point" in duodecimal numbers: 54;612 equals 64.510.
Other uses
The semicolon is commonly used as parts of emoticons, in order to indicate winking or crying, as in ;)
and ;_;
.
Project Semicolon is the name of an anti-suicide initiative (since the semicolon continues a sentence rather than ending it) which has led to the punctuation mark becoming a highly symbolic and popular tattoo (most commonly done on the wrist). While some consider this to be faith-based,{{cite web | url=http://www.huffingtonpost.com/2015/07/07/project-semicolon-tattoos_n_7745358.html | title=RELIGION Global Semicolon Tattoo Trend Is A Sign Of Strength Among Faithful Individuals Dealing With Mental Health Problems | work=The Huffington Post | date=7 July 2016 | access-date=2016-10-02 | author=Steyer, Carly | archive-date=2016-10-09 | archive-url=https://web.archive.org/web/20161009184224/http://www.huffingtonpost.com/2015/07/07/project-semicolon-tattoos_n_7745358.html | url-status=live }} the movement is in general faith-neutral and is inclusive for all people.
See also
- {{Annotated link |Colon (punctuation)|Colon}}
- {{Annotated link |Comma}}
- {{Annotated link |Full stop}}
Notes
{{notelist}}
References
{{Reflist|30em}}
Sources
- {{Cite conference| doi = 10.1145/800027.808420| title = The impact of language design on the production of reliable software| work = Proceedings of the international conference on Reliable software| pages = 10–22 | year = 1975| last1 = Gannon | first1 = J. D.| last2 = Horning | first2 = J. J.}}
- {{cite book|title=Eats, Shoots & Leaves: The Zero Tolerance Approach to Punctuation|last=Truss|first=Lynn|author-link=Lynne Truss|year= 2004|publisher=Gotham Books|location=New York|isbn= 1-59240-087-6}}
Further reading
- {{Cite magazine|last=Collins|first=Paul|author-link=Paul Collins (American writer)|date=20 June 2008|title=Has Modern Life Killed the Semicolon?|url=http://www.slate.com/id/2194087/|magazine=Slate|access-date=23 January 2019}}
- {{cite book|last=Hacker|first=Diana|year=2008|title=The Bedford Handbook|edition=6th|location=Boston|publisher=Bedford/St. Martin's|isbn=978-0-312-41281-4|title-link=The Bedford Handbook}}
- {{Cite news |last=Henley |first=Jon |date=3 April 2008 |title=The End of the Line? |url=https://www.theguardian.com/world/2008/apr/04/france.britishidentity |location=London |work=The Guardian |access-date=23 January 2019}}
- {{Cite news|last=Roberts|first=Sam|author-link=Sam Roberts (newspaper journalist)|date=19 February 2008|orig-year=18 February 2008|title=Delegating the Semicolon in a Most Unlikely Location|url=https://www.nytimes.com/2008/02/18/nyregion/18semicolon.html|work=The New York Times|page=B3 [as "Celebrating the Semicolon in a Most Unlikely Location"]|access-date=23 January 2019}}
- {{cite book|last=Watson|first=Cecelia|author-link=Cecelia Watson|title=Semicolon – The Past, Present, and Future of a Misunderstood Mark|year=2019|publisher=HarperCollins|isbn=978-0062853059}}
{{Navbox punctuation}}
{{Authority control}}