Control Structures (Python 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 (indented)  

#-- next statement (not indented)


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 (indented)  

else:

    #-- false block (indented)  

#-- next statement (not indented)


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  (indented) 

elif condition-1 :

    #-- block-1 (indented)  


#-- other elif blocks go here



elif condition-n :
{
    #-- block-n (indented)  

else:

    #-- default block (indented)  

#-- 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 (indented)  

#-- next statement