Difference between revisions of "statement"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "{{statement}} A statement is a part of a program that performs a task. Typical statement are assignment( Becomes|<syntaxhighlight lang="pascal" enclose="none">:...")
 
(review)
Line 1: Line 1:
 
{{statement}}
 
{{statement}}
  
A statement is a part of a [[Program|program]] that performs a task. Typical statement are assignment( [[Becomes|<syntaxhighlight lang="pascal" enclose="none">:=</syntaxhighlight>]]), condition statement(eg [[If|<syntaxhighlight lang="pascal" enclose="none">if</syntaxhighlight>]],
+
Statements are parts of a [[Executable program|program]] that alter its state, e. g. by changing a [[Variable|variable’s]] value.
[[Case|<syntaxhighlight lang="pascal" enclose="none">case</syntaxhighlight>]]), repetition sentence (eg, [[While|<syntaxhighlight lang="pascal" enclose="none">while</syntaxhighlight>]],  
+
 
[[For|<syntaxhighlight lang="pascal" enclose="none">for</syntaxhighlight>]]), and [[Procedure|<syntaxhighlight lang="pascal" enclose="none">procedure</syntaxhighlight>]] or
+
== classification ==
[[Function|<syntaxhighlight lang="pascal" enclose="none">function</syntaxhighlight>]] call
+
One may distinguish between simple and structured statements.
The statement may contain internal parts (eg [[expression|expressions]]).
+
 
 +
Elementary statements are those, which can not be broken down into smaller pieces – “sub-statements”.
 +
These are
 +
* [[Becomes|assignments]],
 +
* [[Routine#invoking routines|procedure calls]],
 +
* [[Raise|<syntaxhighlight lang="pascal" enclose="none">raise</syntaxhighlight>]] control transfer, and
 +
* [[Goto|<syntaxhighlight lang="pascal" enclose="none">goto</syntaxhighlight> jumps]].
 +
Complex statements are
 +
* compound statements (also called ''sequence'') delimited by [[Begin|<syntaxhighlight lang="pascal" enclose="none">begin</syntaxhighlight>]] and [[End|<syntaxhighlight lang="pascal" enclose="none">end</syntaxhighlight>]],
 +
* inline assembler blocks delimited by [[Asm|<syntaxhighlight lang="pascal" enclose="none">asm</syntaxhighlight>]] and <syntaxhighlight lang="pascal" enclose="none">end</syntaxhighlight>,
 +
* [[Branches|branches]], and
 +
* [[Loops|loops]].
 +
 
 +
== remarks ==
 +
In contrast to statements, instructions are the building blocks in low-level [[Assembly language|assembly language]].
 +
 
 +
[[;|Empty statements]] are not statements in a formal sense, since they merely exist to satisfy syntax requirements in a non-superfluous manner.
 +
 
 +
== see also ==
 +
* [[Block|block]]
 +
* [[expression]]
 +
* [https://www.freepascal.org/docs-html/ref/refch13.html Chapter “Statements” in the ''Free Pascal reference guide'']

Revision as of 18:45, 23 August 2019

English (en) suomi (fi)

Statements are parts of a program that alter its state, e. g. by changing a variable’s value.

classification

One may distinguish between simple and structured statements.

Elementary statements are those, which can not be broken down into smaller pieces – “sub-statements”. These are

Complex statements are

  • compound statements (also called sequence) delimited by begin and end,
  • inline assembler blocks delimited by asm and end,
  • branches, and
  • loops.

remarks

In contrast to statements, instructions are the building blocks in low-level assembly language.

Empty statements are not statements in a formal sense, since they merely exist to satisfy syntax requirements in a non-superfluous manner.

see also