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:
“In so far as the statements of geometry speak about reality, they are not certain, and in so far as they are certain, they do not speak about reality.”
—Albert Einstein (18791955)
“The true critic is a scrupulous avoider of formulae; he refrains from statements which pretend to be literally true; he finds fact nowhere and approximation always.”
—T.S. (Thomas Stearns)
“A sentence is made up of words, a statement is made in words.... Statements are made, words or sentences are used.”
—J.L. (John Langshaw)