Documentation (c) 2006-2008 Hobby-Robotics, LLC
If ... Then is the flow control statement.
Syntax:
If condition Then
...
End If
If condition Then
...
Else
...
End If
If condition Then
...
ElseIf condition1 Then
...
ElseIf conditionN Then
...
End If
If condition Then
...
ElseIf condition1 Then
...
ElseIf conditionN Then
...
Else
...
End If
condition | Expression evaluating to Boolean value |
condition1 | Expression evaluating to Boolean value |
conditionN | Expression evaluating to Boolean value |
... | 0 or more valid statements |
Description:
Flow control statement, executes block of statements based on the condition[1...N]. Has following forms.
If Then form
If condition evaluates to Boolean value True statements between If and End If statements are executed.
If condition evaluates to Boolean value False then none of statements are executed.
If Then Else form
If condition evaluates to Boolean value True then statements between If and Else statements are executed.
If condition evaluates to Boolean value False then statements between Else and End If statements are executed.
If Then ElseIf Then form
If condition evaluates to Boolean value True then statements between If and ElseIf statements are executed.
If condition evaluates to Boolean value False then condition1 following ElseIf statement is evaluated.
If condition1 evaluates to Boolean value True then statements between ElseIf and next ElseIf statements are executed.
If condition1 evaluates to Boolean value False then condition2 following ElseIf statement is evaluated.
The above process is repeated if the current condition evaluates to False up to conditionN.
If none of the conditions evaluates to True then none of the statements is executed.
If Then ElseIf Then Else form
The execution flow is the same as If Then ElseIf Then except for the last step.
If none of the conditions evaluates to True then then statements between Else and End If statements are executed.