request switch statement with common block

dennis luehring dl.soluz at gmx.net
Mon Aug 5 02:37:10 PDT 2013


Am 05.08.2013 08:28, schrieb luminousone:
> or perhaps
>
> for( int i = 0 ; i < 10 ; i ++ )
> in {
>       assert( i == 0 );
> }
> out {
>       assert( i == 9 );
> }
> body {
>      ... stuff ...
> }

that is just evil code

if you got something todo before or on the first item of the list do it 
before the loop - and for the last behind the for loop

if we talk about code-duplication then - use an inner function

this type of sub-branching "de-looping" is slow (if performance is 
relevant) and just not foreach-able, and so not functional-style 
programming - its called "for loop index micro management for unknown 
reasons" - but many programmers prefer it very much :)






More information about the Digitalmars-d mailing list