Glossary: Compound Statement

A compound statement consists of none or more C++ statements enclosed within a set of braces: {}. It is an essential concept in C++ and is central to the idea of nesting constructs. For example, the if statement has the form:-
if ( expression ) statement
which would severely limit its use were it not for the fact that a compound statement is itself a statement. Consequently any number of statments can be enclosed within a set of braces, including other if and compound ones, and the resulting compound statement used with the if statement. For example:- if ( a > b ) { Float_t temp = b; b = a; a = temp; } See {..}
Go Back to the The Glossary Top Page


If you have any comments about this page please send them to Nick West