Semicolons are prevalent in most programming languages. Most are familiar with them through their use as statement terminators in C-derived languages, but their pedigree is even older than that. ALGOL used them as statement separators, as do most of its descendants. In fact, the 70s bore witness to quite a battle between proponents of semicolon-as-separators against those who believed in semicolons-as-terminators. OCaml, which comes from an entirely different branch of language evolution, even considers the double-semicolon (
;;) to be a distinct token, although it only has meaning in the interpreter.
While the most popular use of semicolons is in the context of statements, some languages use them for other purposes. For example, F# and Matlab use semicolons for separating elements in collections, and in Lisp they are used for comments.
Clearly semicolons are widespread, but which languages do not use semicolons at all? This page is an attempt at a list, although it elides esoteric languages, unless they are very notable (like Brainfuck).
Do you know of any languages I’ve missed? Please write me.
COBOL (treats semicolon as whitespace)
FORTRAN (very old versions)
TeX (although some macro packages may define a special meaning for semicolon)
Some languages do syntactically use semicolons, but they are rarely used in practice. Usually this is by some other mechanism that “automatically” inserts them during parsing.
Go uses automatic insertion, and it is a widespead style. However, it is still used in other constructs, such as
Prolog predefines a semicolon infix operator in the standard environment (for disjunction), but it is not assigned special status by the syntax of the language.
Scala uses automatic insertion at linebreaks, but it is not uncommon to put multiple semicolon-separated statements on a single line.
Transact-SQL (the SQL dialect used by SQL Server and Sybase) supports semicolons, but it is only used under very rare circumstances.