Instructions
206Compiler
© 2013 Conrad Electronic
Instructions2
Else
Instructions3
End If
After the if instruction an Arithmetic Expression will follow. If this Expression is evaluated as un-
equal 0 then Instruction1 will be executed. By use of the command word else an alternative Instruc-
tion2 can be defined which will be executed when the Expression has been calculated as 0. The ad-
dition of an else instruction is optional and not really necessary.
If directly in an Else branch an If instruction needs again to be placed then it is possible to initialize
an If again direcly by use of an ElseIf. Thus the new If does not need to be interlocked into an Else
block and the source text remains more clearly.
Examples:
If a=2 Then
b=b+1
End If
If x=y Then
a=a+2
Else
a=a-2
End If
If a<5 Then
a=a-2
ElseIf a<10 Then
a=a-1
Else
a=a+1
End If
4.3.6.6 Select Case
If depending on the value of an expression various commands should be executed then a Select
Case instruction seems to be an elegant solution:
Select Case Expression
Case constant_comparison1
Instructions_1
Case constant_comparison2
Instructions_2
.
.
Case constant_comparison_x
Instructions_x
Else ' Else is optional
Instructions