Control Structures (Java/C++/C# Style)

A control structure determines the order in which statements will be executed. In addition to sequential execution, the Jeroo language supports four control structures

The if Structure

The if structure is used to define an optional block of code.

if( condition )
{

    // true block  
}
// next statement


The if-else Structure

The if-else structure is used to define alternate blocks of code.
Only one of the blocks will be executed.

if( condition )
{

    // true block  
}
else
{

    // false block  
}
// next statement


The cascaded if Structure

The cascaded if is a variation on the if-else structure.
The cascaded if is used to define three or more blocks of code.
Only one of the blocks will be executed.

if( condition-0 )
{

    // block-0  
}
else if(
condition-1 )
{

    // block-1  
}


// other else-if blocks go here


else if( condition-n )
{

    // block-n  
}
else
{

    // default block  
}
// next statement


The pretest while Structure

The pretest while structure (also called a while loop) is used to define a block of code that will be executed repeatedly as long as a specified condition is true.

while( condition )
{

    // loop body  
}
// next statement