if (condition) {
/* code to run if condition is true */
} else {
/* run some other code instead */
}
if()
designates the if
functiontrue
or false
true
, the code executesfalse
, the else
code executestrue
and false
conditionsif (condition) {
/* code to run if condition is true */
} else if (another condition) {
/* code to run if condition is true */
} //exit if statement and run code below
case
switch (expression) {
case choice1:
run this code
break;
case choice2:
run this code instead
break;
// include as many cases as you like
default:
actually, just run this code
}