Search This Blog

Monday, March 6, 2023

Semicolon

From Wikipedia, the free encyclopedia

;
Semicolon

U+003B
; SEMICOLON (;)

؛
Arabic semi colon Ethiopic semicolon Bamum semicolon

The semicolon or semi-colon ; 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. When a semicolon joins two or more ideas in one sentence, those ideas are then given equal rank. Semicolons can also be used in place of commas to separate the items in a list, particularly when the elements of that list contain commas.

The semicolon is one of the least understood of the standard marks, and so it is not as frequently used by many English speakers.

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

De Ætna. 1496 print by Aldine Press.

In 1496, the semicolon ; is attested in Pietro Bembo's book De Aetna [it] printed by Aldo Manuzio. The punctuation also appears in later writings of Bembo. Moreover, it is used in 1507 by Bartolomeo Sanvito, who was close to Manuzio's circle.

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 , and colon :. Here are four examples used in the book to illustrate this:

Publica, privata; sacra, profana; tua, aliena.
Public, private; sacred, profane; yours, another's.

Ratio docet, si adversa fortuna sit, nimium dolendum non esse; si secunda, moderate laetandum.
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.
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.
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.

Around 1640, in Ben Jonson's book The English Grammar, the character ; is described as "somewhat a longer breath" compared to the comma. The aim of the breathing, according to Jonson, is to aid understanding.

In 1644, in Richard Hodges' The English Primrose, it is written:

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:

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:

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 member would be complete without the concluding one; [...]

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 sentence-internal, making them secondary boundary marks. The semicolon falls between terminal marks and the comma; its strength is equal to that of the colon.

The plural of semicolon in English is semicola or semicolons.

The most common use of the semicolon is to join two independent clauses without using a conjunction like "and". 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 present-day continental French texts. Ideally, the space is less wide than the inter-word spaces. Some guides recommend separation by a hair space. 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.

Applications of the semicolon in English include:

  • 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 entire 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:
    • My wife would like tea; I would prefer coffee.
    • I went to the basketball court; I was told it was closed for cleaning.
    • I told Kate she's running for the hills; I wonder if 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:

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:

1. Death;
2. Imprisonment;
3. Fine;
4. Removal from office; or,
5. Disqualification to hold and enjoy any office of honor, trust, or profit in this State.

Arabic

In Arabic, the semicolon is called fasila manqoota (Arabic: فاصلة منقوطة) which means literally "a dotted comma", and is written inverted ؛. 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". (Arabic: لَعِبَ كَثِيرًا؛ فَٱتَّسَخَتْ مَلَابِسُهُ.)
  • 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". (Arabic: لم تحقق أختك درجات عالية؛ لأنها لم تدرس .)

Greek, Church Slavonic

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. 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 Greek: άνω τελεία, romanized: áno teleía, lit.'up dot', an Interpunct ·.

Church Slavonic with a question mark: гдѣ єсть рождeйсѧ царь їудeйскій; (Where is the one who is born king of the Jews? – Matthew 2:1)

Greek with a question mark: Τι είναι μια διασύνδεση; (What is an interpunct?)

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

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.

Lynne Truss, Eats, Shoots, and Leaves

Some authors have avoided and rejected the usage of the semicolon throughout their works. Lynne Truss stated:

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).

In response to Truss, Ben Macintyre, a columnist in The Times, wrote:

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.

Semicolon use in British fiction has declined by 25% from 1991 to 2021.

Character encoding

The semicolon has an assigned value in computer character encoding standards. In ASCII it is encoded as 0x3B, in EBCDIC it is encoded as 0x5E, and in Unicode it is encoded as U+003B.

Unicode contains encoding for several semicolon characters:

  • U+003B ; SEMICOLON – inherited from ASCII
  • U+037E ; GREEK QUESTION MARK
  • U+061B ؛ ARABIC SEMICOLONArabic script
  • U+1364 ETHIOPIC SEMICOLONGeʽez script
  • U+204F REVERSED SEMICOLON – used in old writing systems, such as Hungarian Runic and Sindhi language
  • U+236E APL FUNCTIONAL SYMBOL SEMICOLON UNDERBAR – used in the APL programming language
  • U+2E35 TURNED SEMICOLON – "indicates sudden glottal closure"
  • U+A6F6 BAMUM SEMICOLONBamum script
  • U+FE14 PRESENTATION FORM FOR VERTICAL SEMICOLON – determines orientation when wide-character scripts are written vertically instead of horizontally
  • U+FE54 SMALL SEMICOLONSmall Form Variants are for compatibility with Chinese National Standard CNS 11643
  • U+FF1B FULLWIDTH SEMICOLON – for use in wide-character scripts such as kanji
  • U+E003B TAG SEMICOLON – deprecated tags block

Computing

Programming

In computer programming, the semicolon is often used to separate multiple statements (for example, in Perl, Pascal, and SQL; see Pascal: Semicolons as statement separators). In other languages, semicolons are called terminators and are required after every statement (such as in PL/I, Java, and the C family). Today semicolons as terminators has largely won out, but this was a divisive issue in programming languages from the 1960s into the 1980s. An influential and frequently cited study in this debate was 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." The study has been criticized as flawed by proponents of semicolon as a separator, 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, Python, R, Eiffel, and Go, 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 and falls between the comma , – used as a list separator – and the period/full stop . – 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.

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 and to separate axes when indexing multidimensional arrays, for example, matrix[2;3].

Other languages (for instance, some assembly languages and LISP 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, semicolons or commas can be used to separate table elements.

In MATLAB and GNU Octave, 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. The declarations of a style attribute in Cascading Style Sheets (CSS) are separated and terminated with semicolons.

The file system of RSX-11 and OpenVMS, Files-11, uses semicolons to indicate a file's version number. The semicolon is permitted in long filenames in the Microsoft Windows file systems NTFS and VFAT, but not in its short names.

In some delimiter-separated values file formats, the semicolon is used as the separator character, as an alternative to comma-separated values.

Mathematics

In the argument list of a mathematical function , a semicolon may be used to separate variables from fixed parameters.

In differential geometry, 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:

The ; 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 a faith-based 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, which is most commonly done on the wrist.

Sunday, March 5, 2023

Colon (punctuation)

From Wikipedia, the free encyclopedia
:
Colon
U+003A : COLON (:)
 

The colon, :, is a punctuation mark consisting of two equally sized dots aligned vertically. A colon often precedes an explanation, a list, or a quoted sentence. It is also used between hours and minutes in time, between certain elements in medical journal citations, between chapter and verse in Bible citations, and, in the US, for salutations in business letters and other formal letter writing.

History

In Ancient Greek, in rhetoric and prosody, the term κῶλον (kôlon, lit. 'limb, member of a body') did not refer to punctuation, but to a member or section of a complete thought or passage; see also Colon (rhetoric). From this usage, in palaeography, a colon is a clause or group of clauses written as a line in a manuscript.

In the 3rd century BC, Aristophanes of Byzantium is alleged to have devised a punctuation system, in which the end of such a kôlon was thought to occasion a medium-length breath, and was marked by a middot ·. In practice, we don't have much evidence for its early usage, but it was revived later as the ano teleia, the modern Greek semicolon. Some writers also used a double dot symbol , that later came to be used as a full stop or to mark a change of speaker. (See also Punctuation in Ancient Greek.)

In 1589, in The Arte of English Poesie, the English term colon and the corresponding punctuation mark : is attested:

For these respectes the auncient reformers of language, inuented, three maner of pauses [...] The shortest pause or intermission they called comma [...] The second they called colon, not a peece but as it were a member for his larger length, because it occupied twise as much time as the comma. The third they called periodus, [...]

In 1622, in Nicholas Okes' print of William Shakespeare's Othello, the typographical construction of a colon followed by a hyphen or dash to indicate a restful pause is attested. This construction, known as the dog's bollocks, was once common in British English; though this usage is now discouraged.

As late as the 18th century, John Mason related the appropriateness of a colon to the length of the pause taken when reading the text aloud, but silent reading eventually replaced this with other considerations.

Usage in English

In modern English usage, a complete sentence precedes a colon, while a list, description, explanation, or definition follows it. The elements which follow the colon may or may not be a complete sentence: since the colon is preceded by a sentence, it is a complete sentence whether what follows the colon is another sentence or not. While it is acceptable to capitalise the first letter after the colon in American English, it is not the case in British English, except where a proper noun immediately follows a colon.

Colon used before list
Daequan was so hungry that he ate everything in the house: chips, cold pizza, pretzels and dip, hot dogs, peanut butter, and candy.
Colon used before a description
Bertha is so desperate that she'll date anyone, even William: he's uglier than a squashed toad on the highway, and that's on his good days.
Colon before definition
For years while I was reading Shakespeare's Othello and criticism on it, I had to constantly look up the word "egregious" since the villain uses that word: outstandingly bad or shocking.
Colon before explanation
I guess I can say I had a rough weekend: I had chest pain and spent all Saturday and Sunday in the emergency room.

Some writers use fragments (incomplete sentences) before a colon for emphasis or stylistic preferences (to show a character's voice in literature), as in this example:

Dinner: chips and juice. What a well-rounded diet I have.

The Bedford Handbook describes several uses of a colon. For example, one can use a colon after an independent clause to direct attention to a list, an appositive, or a quotation, and it can be used between independent clauses if the second summarizes or explains the first. In non-literary or non-expository uses, one may use a colon after the salutation in a formal letter, to indicate hours and minutes, to show proportions, between a title and subtitle, and between city and publisher in bibliographic entries.

Luca Serianni, an Italian scholar who helped to define and develop the colon as a punctuation mark, identified four punctuational modes for it: syntactical-deductive, syntactical-descriptive, appositive, and segmental.

Syntactical-deductive

The colon introduces the logical consequence, or effect, of a fact stated before.

There was only one possible explanation: the train had never arrived.

Syntactical-descriptive

In this sense the colon introduces a description; in particular, it makes explicit the elements of a set.

I have three sisters: Daphne, Rose, and Suzanne.

Syntactical-descriptive colons may separate the numbers indicating hours, minutes, and seconds in abbreviated measures of time.

The concert begins at 21:45.
The rocket launched at 09:15:05.

British English, however, more frequently uses a point for this purpose:

The programme will begin at 8.00 pm.
You will need to arrive by 14.30.

A colon is also used in the descriptive location of a book verse if the book is divided into verses, such as in the Bible or the Quran:

"Isaiah 42:8"
"Deuteronomy 32:39"
"Quran 10:5"

Appositive

Luruns could not speak: he was drunk.

An appositive colon also separates the subtitle of a work from its principal title. (In effect, the example given above illustrates an appositive use of the colon as an abbreviation for the conjunction 'because'.) Dillon has noted the impact of colons on scholarly articles, but the reliability of colons as a predictor of quality or impact has also been challenged. In titles, neither needs to be a complete sentence as titles do not represent expository writing:

Star Wars Episode VI: Return of the Jedi

Segmental

Like a dash or quotation mark, a segmental colon introduces speech. The segmental function was once a common means of indicating an unmarked quotation on the same line. The following example is from the grammar book The King's English:

Benjamin Franklin proclaimed the virtue of frugality: A penny saved is a penny earned.

This form is still used in written dialogues, such as in a play. The colon indicates that the words following an individual's name are spoken by that individual.

Patient: Doctor, I feel like a pair of curtains.
Doctor: Pull yourself together!

Use of capitals

Use of capitalization or lower-case after a colon varies. In British English, and in most Commonwealth countries, the word following the colon is in lower case unless it is normally capitalized for some other reason, as with proper nouns and acronyms. British English also capitalizes a new sentence introduced by colon's segmental use.

American English goes further and permits writers to similarly capitalize the first word of any independent clause following a colon. This follows the guidelines of some modern American style guides, including those published by the Associated Press and the Modern Language Association. The Chicago Manual of Style, however, requires capitalization only when the colon introduces a direct quotation, a direct question, or two or more complete sentences.

In many European languages, the colon is usually followed by a lower-case letter unless the upper case is required for other reasons, as with British English. German usage requires capitalization of independent clauses following a colon. Dutch further capitalizes the first word of any quotation following a colon, even if it is not a complete sentence on its own.

Spacing

In print, a thin space was traditionally placed before a colon and a thick space after it. In modern English-language printing, no space is placed before a colon and a single space is placed after it. In French-language typing and printing, the traditional rules are preserved.

One or two spaces may be and have been used after a colon. The older convention (designed to be used by monospaced fonts) was to use two spaces after a colon.

Usage in other languages

Suffix separator

In Finnish and Swedish, the colon can appear inside words in a manner similar to the apostrophe in the English possessive case, connecting a grammatical suffix to an abbreviation or initialism, a special symbol, or a digit (e.g., Finnish USA:n and Swedish USA:s for the genitive case of "USA", Finnish %:ssa for the inessive case of "%", or Finnish 20:een for the illative case of "20").

Abbreviation mark

Written Swedish uses colons in contractions, such as S:t for Sankt (Swedish for "Saint") – for example in the name of the Stockholm metro station S:t Eriksplan, and k:a for kyrka ("church") – for instance Svenska k:a (Svenska kyrkan), the Evangelical Lutheran national Church of Sweden. This can even occur in people's names, for example Antonia Ax:son Johnson (Ax:son for Axelson). Early Modern English texts also used colons to mark abbreviations.

Word separator

15th century Bible text in Ge'ez script showing colons between the words.

In Ethiopia, both Amharic and Ge'ez script used and sometimes still use a colon-like mark as word separator.

End of sentence or verse

In Armenian, a colon indicates the end of a sentence, similar to a Latin full stop or period.

In Hebrew, the sof pasuq is used in some writings such as prayer books to signal the end of a verse.

Score divider

In German, a colon divides the scores of opponents in sports and games. A result of 149–0 would be written as 149 : 0 in German.

Mathematics and logic

The colon is used in mathematics, cartography, model building, and other fields—in this context it denotes a ratio or a scale, as in 3∶1 (pronounced "three to one").

When a ratio is reduced to a simpler form, such as 10∶15 to 2∶3, this may be expressed with a double colon as 10∶15∶∶2∶3; this would be read "10 is to 15 as 2 is to 3". This form is also used in tests of logic where the question of "Dog is to Puppy as Cat is to _____?" can be expressed as "Dog∶Puppy∶∶Cat∶_____". For these usages the proper Unicode symbol is (U+2236 RATIO) that is a little higher up than the normal colon. Compare 2∶3 (ratio colon) with 2:3 (normal colon).

In some languages (e.g. German, Russian, and French), the colon is the commonly used sign for division (instead of ÷). (See also Division sign and Division (mathematics) § Notation.)

The notation |G : H| may also denote the index of a subgroup.

The notation ƒ : X → Y indicates that f is a function with domain X and codomain Y.

The combination with an equal sign () is used for definitions.

In mathematical logic, when using set-builder notation for describing the characterizing property of a set, it is used as an alternative to a vertical bar (which is the ISO 31-11 standard), to mean "such that". Example:

(S is the set of all x in (the real numbers) such that x is strictly greater than 1 and strictly smaller than 3)

In older literature on mathematical logic, it is used to indicate how expressions should be bracketed (see Glossary of Principia Mathematica).

In type theory and programming language theory, the colon sign after a term is used to indicate its type, sometimes as a replacement to the "∈" symbol. Example:

.

A colon is also sometimes used to indicate a tensor contraction involving two indices, and a double colon (::) for a contraction over four indices.

A colon is also used to denote a parallel sum operation involving two operands (many authors, however, instead use a sign and a few even a for this purpose).

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:

  • U+003A : COLON
  • U+02D0 ː MODIFIER LETTER TRIANGULAR COLON, used in IPA.
  • U+10781 𐞁 MODIFIER LETTER SUPERSCRIPT TRIANGULAR COLON, IPA modifier-letter.
  • U+02D1 ˑ MODIFIER LETTER HALF TRIANGULAR COLON, used in IPA.
  • U+10782 𐞂 MODIFIER LETTER SUPERSCRIPT HALF TRIANGULAR COLON, IPA modifier-letter.[32]
  • U+02F8 ˸ MODIFIER LETTER RAISED COLON, used by Uralic Phonetic Alphabet.
  • U+05C3 ׃ HEBREW PUNCTUATION SOF PASUQ, compatible with right-to-left text.
  • U+2236 RATIO, for mathematical usage.
  • U+2254 COLON EQUALS, for use in pretty-printing programming languages.
  • U+2255 EQUALS COLON
  • U+2360 APL FUNCTIONAL SYMBOL QUAD COLON
  • U+2982 Z NOTATION TYPE COLON
  • U+2A74 DOUBLE COLON EQUAL
  • U+2AF6 TRIPLE COLON OPERATOR
  • U+A789 MODIFIER LETTER COLON, see Colon (letter), sometimes used in Windows filenames 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.
  • U+FE13 PRESENTATION FORM FOR VERTICAL COLON, compatibility character for the Chinese Standard GB 18030.
  • U+FF1A FULLWIDTH COLON, for compatibility with halfwidth and fullwidth fonts.
  • U+FE55 SMALL COLON, compatibility character for the Chinese National Standard CNS 11643.

Programming languages

A number of programming languages, most notably Pascal and Ada, use a colon immediately followed by an equals sign (:=) as the assignment operator, to distinguish it from a single equals which is an equality test (C instead used a single equals as assignment, and a double equals as the equality test).

Many languages including C and Java use the colon to indicate the text before it is a label, such as a target for a goto or an introduction to a case in a switch statement. In a related use, Python uses a colon to separate a control statement from the block of statements it controls:

if test(x):
    print("test(x) is true!")
else:
    print("test(x) is not true...")

In a number of languages, including JavaScript, colons are used to define name–value pairs in a dictionary or object. This is also used by data formats such as JSON. Some other languages use an equals sign.

var obj = {
    name: "Charles",
    age: 18,
}

The colon is used as part of the ?: conditional operator in C and many other languages.[37]: 90 

C++ uses a double colon as the scope resolution operator, and class member access. 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, which uses a single colon.

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.

In Forth, a colon precedes definition of a new word.

Haskell uses a colon (pronounced as "cons", short for "construct") as an operator to add an element to the front of a list:

"child" : ["woman", "man"] -- equals ["child","woman","man"]

while a double colon :: is read as "has type of" (compare scope resolution operator):

("text", False) :: ([Char], Bool)

The ML languages (such as Standard ML) have the above reversed, where the double colon (::) is used to add an element to the front of a list; and the single colon (:) is used for type guards.

MATLAB uses the colon as a binary operator that generates vectors, as well as to select particular portions of existing matrices.

APL uses the colon:

  • to introduce a control structure element. In this usage it must be the first non-blank character of the line.
  • after a label name that will be the target of a :goto or a right-pointing arrow (Note: this style of programming is deprecated and programmers are encouraged to use control structures instead).
  • to separate a guard (boolean expression) from its expression in a dynamic function. Two colons are used for an Error guard (one or more error numbers).
  • Colon + space are used in class definitions to indicate inheritance.
  • ⍠ (a colon in a box) is used by APL for its variant operator.

The colon is also used in many operating systems commands.

In the esoteric programming language INTERCAL, the colon is called "two-spot" and is used to identify a 32-bit variable—distinct from a spot (.) which identifies a 16-bit variable.

Addresses

Internet URLs use the colon to separate the protocol (such as http:) from the hostname or IP address.

In an IPv6 address, colons (and one optional double colon) separate up to 8 groups of 16 bits in hexadecimal representation. In a URL, a colon follows the initial scheme name (such as HTTP and FTP), and separates a port number from the hostname or IP address.

In Microsoft Windows filenames, the colon is reserved for use in alternate data streams and cannot appear in a filename. 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 CON: though this gradually disappeared except for disks (where it had to be between the disk name and the required path representation of the file as in C:\Windows\). This then migrated to use in URLs.

Text markup

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.

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 Renders as
Normal text.
:Indented text by the means of a colon.
::The gap increases with colon number.

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 asterisks are used) 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 emoticons.

Science fiction magazine

From Wikipedia, the free encyclopedia https://en.wikipedia.org/wiki/Science_fi...