Deep nesting vs early returns

Jacob Carlborg doob at me.com
Thu Oct 4 12:05:37 UTC 2018


On Thursday, 4 October 2018 at 06:43:02 UTC, Gopan wrote:

> Certain people recommend that there be only one return 
> statement (usually at the end) from a function.  The said 
> advantage is that, in a maintenance code, if you later want to 
> do something before returning, you can add it just above the 
> return statement.

D has the “scope” statement for this.

—
/Jacob Carlborg


More information about the Digitalmars-d mailing list