Statements

From RAD Studio
Jump to: navigation, search

Go Up to Statements Index

Statements specify the flow of control as a program executes. In the absence of specific jump and selection statements, statements are executed sequentially in the order of appearance in the source code. The following table shows the syntax for statements.

C++Builder Statements

statement

labeled-statement
compound-statement
expression-statement
selection-statement
iteration-statement
jump-statement
asm-statement
declaration (C++ specific)

labeled-statement:

identifier : statement
case constant-expression : statement
default : statement

compound-statement:

{ <declaration-list> <statement-list> }

declaration-list:

declaration
declaration-list declaration

statement-list:

statement
statement-list statement

expression-statement:

<expression> ;

asm-statement:

asm tokens newline
asm tokens;
asm { tokens; <tokens;>= <tokens;>}

selection-statement:

if ( expression ) statement
if ( expression ) statement else statement
switch ( expression ) statement

iteration-statement:

while ( expression ) statement
do statement while ( expression ) ;
for (for-init-statement <expression> ; <expression>) statement

for-init-statement:

expression-statement
declaration (C++ specific)

jump-statement:

goto identifier ;
continue ;
break ;
return <expression> ;