Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/17/06 05:33
Read: times


 
#128147 - One advantage
Responding to: ???'s previous message
Dear Jez,



if you dont put a break statement at the end of each case it just drops through and performs all the coditional statements after the first condition match



there is on advantage i can guess. If i want to write a switch statement having same code for some subset of switch values like


case 'A','S','D','F'
      blah
      blah

case <next>

i can write

switch(ch)
{
     case 'A':
     case 'S':
     case 'D':
     case 'F':
       blah;
       blah;
       break;
     case <next>:
}





Abhishek

List of 6 messages in thread
TopicAuthorDate
(SDC)C how to 2            01/01/70 00:00      
   Something like this?            01/01/70 00:00      
      maybe this is it...            01/01/70 00:00      
   I would use switch            01/01/70 00:00      
      One advantage            01/01/70 00:00      
   Yeah you are right its not that bizzare            01/01/70 00:00      

Back to Subject List