Jump Statement
A JMP statement will unconditionally move the execution to the defined label.
VAR
a : INT;
END_VAR
// Define a label
aLabel:
a := a + 1;
IF a < 5 THEN
JMP aLabel; // Jump to the label
END_IF;
print(a);
warning
JMP statements should always be in some form of conditional statement to avoid an infinite loop.
Infinite loop
VAR
a : INT;
END_VAR
// Define a label
aLabel:
a := a + 1;
// This will cause an infinite loop!
JMP aLabel;
print(a);