Compound Statements

Compound statements are multiple statements grouped into a single logical statement.

  • '{' [statement-list] '}'

Details

Details are as follows:

  • Compound statements can be used where more than one statement is required.
  • Compound statements do not end with a semicolon.
  • The statement list in a compound statement is optional.
  • Compound statements introduce a new scope into the name scope hierarchy.

Examples

The following example uses a compound statement to group two statements together into one logical statement.

{
   x = y * 2;
   z = x + y;
}

The following example uses a compound statement to hide a variable in the compound statement's scope. This example prints the string 5 to the Scenome application's output window.

{
   int x = 10;
}

int x = 5;
Application.Log.LogString( x );