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?

Kind of ... except that we don't allow 'or' or 'and' in the case clause, and only if the first example has the "with fallthru" on its switch statement. However below are equivalent ...

    switch with fallthru do 
	case RHS_SUBS then  
	case RHS_SUBS_CHECK then  
	case RHS_SUBS_I then  
		opRHS_SUBS()  
		break 
    switch do 
    	case RHS_SUBS, RHS_SUBS_CHECK, RHS_SUBS_I then  
		opRHS_SUBS()  

Note that by default, that is if you do not put the "with fallthru" modifier in, then switch works like you thought it would. It does NOT execute anymore than one case clause. If you really want it to execute multiple case clauses you must also add the "with fallthru".

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

Search



Quick Links

User menu

Not signed in.

Misc Menu