List of programming languages that do not use semicolons
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 semicolons-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).
See also the list of programming languages that do not use curly braces.
Do you know of any languages I’ve missed? Send an email!
The list
COBOL (treats semicolon as whitespace)
FORTRAN (very old versions)
TeX (although some macro packages may define a special meaning for semicolon)
Honourable mentions
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
for
loops.Swift treats semicolons as separators, permitting but discouraging multiple statements on a single line.
Haskell avoids semicolons only when using exclusively indentation-based layout, which is a common style. Python and BCPL are similar cases.
Non-textual languages like Scratch or Piet naturally do not make use of semicolons.
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.
Dishonourable mentions
- Javascript supports automatic semicolon insertion (like Go), but its use is somewhat contentious.