Skip to main content

ST Statement: RETURN

Use the RETURN statement in order to exit from a function block. You can make this dependent on a condition, for example.

Example 75. Example
IF xIsDone THEN
        RETURN;
END_IF;

iCounter := iCounter + 1;

If the value of xIsDone is equal to TRUE, then the function block is exited immediately and the statement iCounter := iCounter + 1; is not executed.

Because the RETURN statement also supports conditional returns, the example above can also be described as follows.

RETURN (xIsDone);
iCounter := iCounter + 1;