Avg. Rating 3.5

Problem

Switch case for classes.

Solution

See below for a method I discovered to compile and style your code in a switch case for classes.

Detailed explanation

Assuming your have three classes: 1) class Person 2)  class Human 3) class UFO

So I found it is possible to make class identification if you just put true inside the switch statement :))))

var yourclassitem:*;

switch( true )
{
     case yourclassitem is Person:
          ...
          break;

     case yourclassitem is Human:
          ...
          break;

     case yourclassitem is UFO:
          ...
          break;

     default:

}

have fun coding!


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes