Re: New switch/case idea

new topic     » goto parent     » topic index » view thread      » older message » newer message
irv said...
	case RHS_SUBS then  
	case RHS_SUBS_CHECK then  
	case RHS_SUBS_I then  
		opRHS_SUBS()  
		break 
    	case RHS_SUBS  
        or RHS_SUBS_CHECK   
	or RHS_SUBS_I then  
		opRHS_SUBS()  
		break 

So, the two above are identical?

Sort of. The later does not provide the same level of functionality, if required. For the example, they are. But say you had to increment i if RHS_SUBS, but not for RHS_SUBS_CHECK and RHS_SUBS_I... With your example of or, it would not be very easy, however, with the multiple case statement and fall thru, it's easy:

	case RHS_SUBS then  
		i += 1 
	case RHS_SUBS_CHECK then  
	case RHS_SUBS_I then  
		opRHS_SUBS()  
		break 

If it was RHS_SUBS i would be incremented by 1 and the next line to execute would be opRHS_SUBS().

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu