Control Structures (VB.NET Style)

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

The if Structure

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

If condition Then
    '-- true block  
End If
'-- 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 Then
    '-- true block  
Else
    '-- false block  

End If
'-- 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 Then
    '-- block-0  

ElseIf condition-1 Then
    '-- block-1  

'-- other else-if blocks go here


ElseIf condition-n Then
    '-- block-n  

Else
    '-- default block  

End If
'-- 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  
End While
'-- next statement