[osflash] switch - case

Bob Ippolito bob at redivi.com
Wed Feb 15 14:15:58 EST 2006


On Feb 15, 2006, at 8:59 AM, Jos Yule wrote:

> Ralf Bokelberg wrote:
>> You can do it like this
>>
>> switch( true){
>>      case (model instanceof DivideSentenceStep1):
>>               //...
>>      case (model instanceof DivideSentenceStep2):
>>               //...
>>      default:
>>               //... 		
>> }
>
> That is very clever.

Why the heck would you want to abuse switch like that?

if (mode instanceof ...) {
	// ...
} else if (mode instanceof ...) {
	// ...
} else if (mode instanceof ...) {
	// ...
} else {
	// ...
}

-bob




More information about the osflash mailing list