Statements
Programming language statements typically have conventions for:
- statement separators;
- statement terminators; and
- line continuation
A statement separator is used to demarcate boundaries between two separate statements. A statement terminator is used to demarcate the end of an individual statement. Line continuation is a convention in languages where the newline character could potentially be misinterpreted as a statement terminator. In such languages, it allows a single statement to span more than just one line.
Language | Statement separator/terminator | Secondary separator |
---|---|---|
ABAP | period separated | |
Ada | semicolon terminated | |
ALGOL | semicolon separated | |
ALGOL 68 | semicolon and comma separated | |
AppleScript | newline terminated | |
AutoHotkey | newline terminated | |
BASIC | newline terminated | colon |
Boo | newline terminated | |
C | semicolon terminates statements | comma separates expressions |
C++ | semicolon terminates statements | comma separates expressions |
C# | semicolon terminated | |
COBOL | period separated | |
Cobra | newline terminated | |
D | semicolon terminated | |
Eiffel | newline terminated | semicolon |
Erlang | colon separated, period terminated | |
Falcon | newline separated | |
Fortran | newline terminated | semicolon |
Forth | ? | whitespace |
GFA BASIC | newline terminated | |
Go | semicolon separated (inserted by compiler) | |
Haskell (in do-notation) | semicolon separated | |
Haskell (in do-notation, when braces are omitted) | newline separated | |
Java | semicolon terminated | |
JavaScript | semicolon separated (but sometimes implicitly inserted on newlines) | |
Lua | whitespace separated (semicolon optional) | |
Mathematica | semicolon separated | |
MATLAB | newline terminated | semicolon or comma |
Object Pascal (Delphi) | semicolon separated | |
Objective-C | semicolon terminated | |
OCaml | semicolon separated | |
Pascal | semicolon separated | |
Perl | semicolon separated | |
PHP | semicolon terminated | |
Prolog | period terminated | |
Python | newline terminated | semicolon |
Ruby | newline terminated | semicolon |
Scala | newline terminated (semicolon optional) | semicolon |
Seed7 | semicolon separated (semicolon termination is allowed) | |
Simula | semicolon separated | |
S-Lang | semicolon separated | |
Smalltalk | period separated | |
Standard ML | semicolon separated | |
Visual Basic | newline terminated | |
Visual Basic .NET | newline terminated | |
Windows PowerShell | newline terminated | semicolon separated |
Language | Statement separator/terminator | Secondary separator |
Read more about this topic: Comparison Of Programming Languages (syntax)
Famous quotes containing the word statements:
“The statements of science are hearsay, reports from a world outside the world we know. What the poet tells us has long been known to us all, and forgotten. His knowledge is of our world, the world we are both doomed and privileged to live in, and it is a knowledge of ourselves, of the human condition, the human predicament.”
—John Hall Wheelock (18861978)
“If we do take statements to be the primary bearers of truth, there seems to be a very simple answer to the question, what is it for them to be true: for a statement to be true is for things to be as they are stated to be.”
—J.L. (John Langshaw)
“He admired the terrible recreative power of his memory. It was only with the weakening of this generator whose fecundity diminishes with age that he could hope for his torture to be appeased. But it appeared that the power to make him suffer of one of Odettes statements seemed exhausted, then one of these statements on which Swanns spirit had until then not dwelled, an almost new word relayed the others and struck him with new vigor.”
—Marcel Proust (18711922)