Sugaring the switch()

Michael Haufe TNO at TheNewObjective.com
Fri Sep 5 21:12:49 PDT 2008


I didn't see this mentioned yet, so I'd like to propose implementing a 
feature available in VB.NET that I think would be valuable in ES. Some 
sugar for the switch() block:

switch(foo){
    case 1,2,3:
        //stuff...
    break;
    case a,b,c:
        //stuff...
    break;
}

Would be equivalent to:

switch(foo){
    case 1:
        //stuff...
    break;
    case 2:
        //stuff...
    break;
    case 3:
        //stuff...
    break;
    case a:
        //stuff...
    break;
    case b:
        //stuff...
    break;
    case c:
        //stuff...
    break;
}



More information about the Es-discuss mailing list