Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
RETURN¶
The RETURN statement causes an early exit from the current program
organization unit.
IEC 61131-3 |
Section 3.3.2.5 |
Support |
Supported |
Syntax¶
RETURN ;
Description¶
RETURN terminates execution of the current program, function, or function
block. In a function, the return value is the last value assigned to the
function name before RETURN executes. In a program or function block,
execution resumes at the caller.
Example¶
FUNCTION Divide : DINT
VAR_INPUT
numerator : DINT;
denominator : DINT;
END_VAR
IF denominator = 0 THEN
Divide := 0;
RETURN;
END_IF;
Divide := numerator / denominator;
END_FUNCTION
See Also¶
EXIT — break from innermost loop
FUNCTION — function definition
FUNCTION_BLOCK — function block definition