Return

Returns from a procedure.

Declaration

Syntax

Return()

Arguments

None.

Return values

None.

Description

Return leaves the procedure immediately. A function returns whatever its result variable holds at that point, so there is nothing to carry here: the value is in the return_var of the Function.

Falling off the end of a procedure returns as well, so a Return is only needed for an early exit.

Examples

(Return)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "m" (Module
        :symtab (SymbolTable
          :id 1
          :symbols {
            "noop" (Function
              :symtab (SymbolTable
                :id 2
                :symbols {}
              )
              :name "noop"
              :function_signature (FunctionType
                :arg_types []
                :return_var_type nil
                :abi :Source
                :deftype :Implementation
                :bindc_name nil
                :elemental false
                :pure false
                :module false
                :inline false
                :static false
                :restrictions []
                :is_restriction false
              )
              :dependencies []
              :args []
              :body [
                (Return)
              ]
              :return_var nil
              :access :Public
              :deterministic false
              :side_effect_free false
              :module_file nil
            )
          }
        )
        :name "m"
        :parent_module nil
        :dependencies []
        :loaded_from_mod false
        :intrinsic false
        :has_submodules false
      )
      "main" (Program
        :symtab (SymbolTable
          :id 3
          :symbols {}
        )
        :name "main"
        :dependencies []
        :body []
      )
    }
  )
  :items []
)

See Also

Function, Stop