Thursday, April 14, 2011

Using the switch statement on iPhone or Android

Sometimes using a switch statement can save some space instead of using a bunch of if/then/else statements.

for example:

switch(total) {

case 30.00:
UIImage *img1 = [UIImage imageName:@"filet.jpg"];
break;

case 5.00:
UIImage *img1 = [UIImage imageNamed:@"fastfood.jpg"];
break;


Download World War II trivia game for iPhone

No comments:

Post a Comment