Gotchas for returning values from blocks

Era Scarecrow via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 12 12:30:49 PDT 2016


On Sunday, 12 June 2016 at 18:24:58 UTC, jmh530 wrote:
> I'm just not sure if there are any gotchas to be aware of.

  Aside from forgetting it's it's own block, you might add a 
return statement to it and leave the entire function. Or forget 
what's in what scope (assuming you do more than 1-2 pages of code 
per function). They do sorta behave like inlined void delegate 
functions (skip the call & heavy stack management).

  Unless there's a good reason for using blocks I don't see the 
need, since you will likely use inner scopes in if statements and 
the like anyways.


More information about the Digitalmars-d-learn mailing list