Many operating systems let a program return a result (separate from normal output) when its process terminates; these values are referred to exit statuses.
Conversely, it can be argued that using the return statement is worthwhile when the alternative is more convoluted code, such as deeper nesting, harming readability.
Using Tennent's framework notion of sequencer, Watt uniformly describes the control flow constructs found in contemporary programming languages and attempts to explain why certain types of sequencers are preferable to others in the context of multi-exit control flows.
In contrast, Watt argues that the conceptual intent of a return sequencer is clear from its own context, without having to examine its destination.
Watt also notes that while jump sequencers (gotos) have been somewhat restricted in languages like C, where the target must be an inside the local block or an encompassing outer block, that restriction alone is not sufficient to make the intent of gotos in C self-describing and so they can still produce "spaghetti code".
[15] According to empirical studies cited by Eric S. Roberts, student programmers had difficulty formulating correct solutions for several simple problems in a language like Pascal, which does not allow multiple exit points.
For the problem of writing a function to linearly searching an element in an array, a 1980 study by Henry Shapiro (cited by Roberts) found that using only the Pascal-provided control structures, the correct solution was given by only 20% of the subjects, while no subject wrote incorrect code for this problem if allowed to write a return from the middle of a loop.
[16] Others, including Kent Beck and Martin Fowler argue that one or more guard clauses—conditional "early exit" return statements near the beginning of a function—often make a function easier to read than the alternative.
[17][18][19][20] The most common problem in early exit is that cleanup or final statements are not executed – for example, allocated memory is not unallocated, or open files are not closed, causing leaks.
Some languages, such as C++ and Python, employ concepts which allow actions to be performed automatically upon return (or exception throw) which mitigates some of these issues – these are often known as "try/finally" or similar.
Functionality like these "finally" clauses can be implemented by a goto to the single return point of the subroutine.