request switch statement with common block
    MattCodr 
    mattcoder at hotmail.com
       
    Sat Aug  3 08:42:49 PDT 2013
    
    
  
On Saturday, 3 August 2013 at 14:38:48 UTC, JS wrote:
>
> switch (cond)
>     common: always executed code here
>     case A : etc...
>     ....
> }
>
> instead of
>
> if (cond) { always executed code here  }
> switch (cond)
>     case A : etc...
>     ....
> }
>
> which requires modification of the condition twice when 
> necessary
Why don't you just:
switch(cond)
{
   default:
   // YOUR COMMON HERE
   case A:
     ...
     break;
   ...
}
    
    
More information about the Digitalmars-d
mailing list