切换if-etc语句的优点
switch
if
unsigned
switch
// numError is an error enumeration type, with 0 being the non-error case // fire_special_event() is a stub method for the shared processingswitch (numError){ case ERROR_01 : // intentional fall-through case ERROR_07 : // intentional fall-through case ERROR_0A : // intentional fall-through case ERROR_10 : // intentional fall-through case ERROR_15 : // intentional fall-through case ERROR_16 : // intentional fall-through case ERROR_20 : { fire_special_event(); } break; default: { // error codes that require no additional action } break; }
if
if ((ERROR_01 == numError) || (ERROR_07 == numError) || (ERROR_0A == numError) || (ERROR_10 == numError) || (ERROR_15 == numError) || (ERROR_16 == numError) || (ERROR_20 == numError)){ fire_special_event();}
互换的青春
慕斯王
温温酱
相关分类