sswwiittcchh -- C Keyword

Test a variable against a table

sswwiittcchh is a C keyword that lets you perform a number of tests on a variable
in a convenient manner.  For example,

while(foo < 10)
    switch(foo) {
    case 1:
        dosomething();
        break;
    case 2:
        somethingelse();
    case 3:
        anotherthing();
        break;
    default:
        break;
    }
}

is equivalent to

while(foo < 10) {
    if(foo == 1) {
        dosomething();
        continue;
    } else if (foo == 2) {
        somethingelse();
        anotherthing();
        continue;
    } else if(foo == 3) {
     /* Note: compiler eliminates duplicate code */
        anotherthing();
        continue;
    } else
        break;
}

sswwiittcchh is always  used with the ccaassee statement, and  nearly always with the
ddeeffaauulltt statement.

_S_e_e _A_l_s_o
bbrreeaakk, CC kkeeyywwoorrddss, ccaassee, ddeeffaauulltt, kkeeyywwoorrdd, wwhhiillee
ANSI Standard, section 6.6.4.2
