RETURN Statement

Help Contents

Introduction

The IEC 61131-3 ST RETURN statement exits a Program Unit early.

Examples

  1. Use a RETURN statement to return from a function early:
    Function CheckValue : Bool
        Var_Input Value : Int; End_Var
    
        if Value = 0 Or Value = 2 Then
            CheckValue := false;
            return;
        end_if;
    
        CheckValue := True;
    End_Function

Standards Compliance

IEC 61131-3 Second Edition: Table 56.3.

IEC 61131-3 Third Edition: Table 72.3.

Further Information

Structured Text

For other Structured Text (ST) statement types.

Glossary

For the meaning of terms used in Fernhill SCADA.