lundi 7 décembre 2015

How to conver switch statement to if statement?

I was wondering if I can convert the following into a if statement rather than it being a switch statement.

switch (type) { case PROJECT: case STORY: case DEVELOPER: createdItem = new AggregateItem(name, desc, value); break; case STORY_DEVELOPER: createdItem = new SingleItem(name, value, child); break; default: createdItem = null; }

Aucun commentaire:

Enregistrer un commentaire