RETURN statement in ST
Syntax
RETURN;
Meaning |
The RETURN statement provides early exit from a →function, →function block or →program. |
Example
FUNCTION_BLOCK ExampleReturnDocumentation
VAR_INPUT
RM : BOOL;
END_VAR
VAR_OUTPUT
OUT : INT;
END_VAR
IF (RM = FALSE) THEN
OUT := 1;
RETURN; (* '(RM = FALSE)' causes the early exit of 'ExampleReturnDocumentation'. Subsequently, 'OUT' evaluates to '1'. *)
END_IF;
OUT := 2;
END_FUNCTION_BLOCK