Gotchas for returning values from blocks

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 12 13:18:29 PDT 2016


On Sunday, 12 June 2016 at 19:30:49 UTC, Era Scarecrow wrote:
> 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.

Good points. Thanks for the reply.


More information about the Digitalmars-d-learn mailing list