If construct to branch into a code block and continue after the code block.
If Parameter1 = 10 Then
DoAny := 10
End If
The DoAny variable gets a value of 10 if parameter1 is 10. Otherwise, the program flow continues after the End If.
Alternatively, If constructs can be formulated as follows:
OpenObject := "OpenObject" If OpenObject = NoValue
Here, the assignment described in the front pane is performed only if the condition after the If is met. The advantage is the more compact display.
(
OpenObject := "OpenObject"
OpenObject.Anzahl := 10
) If OpenObject = NoValue
By forming blocks, several program lines can also be executed conditionally.
A condition can be terminated prematurely with the Exit If command. Code execution continues after the End If.
If Pic = NoValue Then
Pic.LoadFile("C:\Pictures\Buche.jpg")
Exit If If Pic <> NoValue
Pic.LoadFile("C:\Pictures\Eiche.jpg")
End If