Return instruction, If instruction, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual
Page 763
 
L-force | PLC Designer
General Editors
DMS 4.1 EN 03/2011 TD29
761
RETURN instruction 
The RETURN instruction can be used to leave a POU, for example depending on a 
condition. 
Syntax: 
RETURN; 
Example: 
IF b=TRUE THEN 
RETURN; 
END_IF; 
a:=a+1; 
If b is TRUE, instruction a:=a+1; will not be executed, the POU will be left immediately. 
 
IF instruction 
With the IF instruction you can check a condition and, depending upon this condition, 
execute instructions. 
Syntax: 
IF <Boolean_expression1> THEN 
<IF_instructions> 
{ELSIF <Boolean_expression2> THEN 
<ELSIF_instructions1> 
. 
. 
ELSIF <Boolean_expression n> THEN 
<ELSIF_instructions n-1> 
ELSE 
<ELSE_instructions>} 
END_IF; 
 
The part in braces {} is optional. 
If the <Boolean_expression1> returns TRUE, then only the <IF_Instructions> are 
executed and none of the other instructions. 
Otherwise the Boolean expressions, beginning with <Boolean_expression2>, are 
evaluated one after the other until one of the expressions returns TRUE. Then only 
those instructions after this Boolean expression and before the next ELSE or ELSIF are 
evaluated. 
If none of the Boolean expressions produce TRUE, then only the <ELSE_instructions> 
are evaluated.