Exit Function (return)

Exits current function scope

Description

return will terminate execution of a block at the scope level (eg function, private, etc)

Conceptually it is the same as break except it doesn’t require the scope name as a parameter and you can specify the exit number rather than defaulting to 0.

Usage

return [ exit-number ]

Examples

Setting an exit number

function example {
    out foo
    return 13
    out bar
}
example
exitnum

Running the above code would output:

foo
13

Returning withing an exit number

If we were to run the same code as above but with return written without any parameters (ie instead of return 13 it would be just return), then you would see the following output:

foo
0

Detail

Any process that has been initialised within a returned scope will have their exit number updated to the value specified in return (or 0 if no parameter was passed).

See Also


This document was generated from builtins/core/structs/break_doc.yaml.

This site's content is rebuilt automatically from murex's source code after each merge to the master branch. Downloadable murex binaries are also built with the website.

Last built on Sat Nov 23 00:50:15 UTC 2024 against commit 69c17da69c17da3bd9db98ca508f6a03a402f074ee24cec.

Current version is 6.4.0375 (develop) which has been verified against tests cases.