Sunday, January 01, 2012

Multiple statements within if

In some cases, we need to execute multiple instructions or statements on satisfying any condition. In such a condition, we need to place the statements within a pair of braces within if statement.

Syntax:
If (Condition)
{
Statement 1;
Statement 2;

...................
Statement n;
}

In this case, if the condition within the if statement is satisfied, then statement 1 to statement n, within the pair of braces will also be executed, else if the condition within the if statement is not satisfied then the program cursor will jump after the closing braces.

No comments:

Post a Comment

Please give your valuable comments or queries if you fell its helpful or if you like the contents of the site. Thanks...