Level 55 Level 57
Level 56

Conditional Statements


8 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
if statement
An if statement consists of a boolean expression followed by one or more statements.
if...else statement
An if statement can be followed by an optional else statement, which executes when the boolean expression is false.
nested if statements
You can use one if or else if statement inside another if orelse if statement(s).
switch statement
A switch statement allows a variable to be tested for equality against a list of values.
the syntax of an if statement
if(Boolean_expression) { code will execute if the Boolean expression is true }
the syntax of an if...else
if(Boolean_expression){ //Executes when the Boolean expression is true }else{ //Executes when the Boolean expression is false }
the syntax of an if...else
if(Boolean_expression 1){ //Executes when the Boolean expression 1 is true }else if(Boolean_expression 2){ //Executes when the Boolean expression 2 is true }else if(Boolean_expression 3){ //Executes when the Boolean expression 3 is true }else { //Executes when the none of the above condition is true. }
the syntax of switch statement
switch(expression){ case value : code break; //optional case value : code break; //optional //You can have any number of case statements. default : //Optional code }