Conditionals

If or Else Statements
if (bowlCounter == 1) { Tweener.addTween(bowl_mc, {width:500, height:500, time:1, transition:"easeInExpo"}); } else if (bowlCounter == 2) { Tweener.addTween(bowl_mc, {width:30, height:30, transition:"easeInExpo"}); } else { // all other exceptions }		

Switch Case Statements
A switch conditional is like a multiway if/else statement. Common uses would be for keyboard presses and other things which require unique outcomes for many different options.

switch (fruitName) { case "orange_mc" : // what happens if its an orange?; break;

case "apple_mc" : // what happens if its an apple?; break;

case "pear_mc" : // what happens if its an pear?; break; }

Note that if it is a string you have to put the quotation marks around the case "string". If it is a number/boolean then you just put the case straight like case 1, case 2. And if its a boolean actually this switch is not suitable for this because a switch is for multiples.

For loops
for (var i = aliensBulletsArray.length - 1; i >= 0; i--) {	aliensBulletsArray[i].y += 10; } 

This is an example of a simple For Loop.

 //Check for collision between player's lasers and aliens for (var i = bulletsArray.length - 1; i >= 0; i--) {				for (var j = aliensArray.length - 1; j >= 0; j--) {					if (bulletsArray[i].hitTestObject(aliensArray[j])) {						//Hit! //Remove both score += 10; removeChild(bulletsArray[i]); removeChild(aliensArray[j]); bulletsArray.splice(i,1); aliensArray.splice(j,1); //1 laser can only hit 1 alien, exit the loop break; }				}			} 

This is an example of a slightly more complicated For Loop.