cfp 4 Flashcards
instead of writing many if else statements, use
switch statement
selects one of many code blocks to be executed
switch statement
stop the execution of more code and case testing inside the block
break keyword
can save a lot of execution time because it “ignores” the execution of all the rest of the code in the switch block
break
specifies some code to run if there is no case match
default keyword
can execute a block of code as long as a specified condition is reached
loops
loops through a block of code as long as a specified condition is true
while loop
is a variant of the while loop
do/while loop
execute the code block once before checking if the condition is true, then it will repeat the loop as long as the condition is true
do/while loop
when you know exactly how many times you want to loop through a block of code
for loop
was used to “jump out” of a switch statement
break
breaks one iteration, if a specified condition occurs, and continues with the next iteration on the loop
continue