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:
“There is a certain embarrassment about being a storyteller in these times when stories are considered not quite as satisfying as statements and statements not quite as satisfying as statistics; but in the long run, a people is known, not by its statements or its statistics, but by the stories it tells.”
—Flannery OConnor (19251964)
“The wise man regulates his conduct by the theories both of religion and science. But he regards these theories not as statements of ultimate fact but as art-forms.”
—J.B.S. (John Burdon Sanderson)
“Science is a system of statements based on direct experience, and controlled by experimental verification. Verification in science is not, however, of single statements but of the entire system or a sub-system of such statements.”
—Rudolf Carnap (18911970)