LESSON: CYCLE LED COLORS WITH BUTTON
STEP 5 - Review CONCEPTS
New Concept: Combining if and else-if Statements
You can combine if and else-if statements to define a wide number of 'paths' for a program to take. Each else-if is another decision for the code to make. You can also use else-if statements to prioritize decisions. Think of deciding where to eat as you walk down a street. You may think "If pizza is available, I'll have that. If not, I'll look for Greek. If that's not available, I'll look for Chinese food.". This set of decisions prioritizes pizza over Greek and Greek over Chinese.
Now imagine the same decision using only if statements. Your decision would be "If pizza is available, I'll have that. If Greek is available, I'll have that. If Chinese is available, I'll have that." You would be extremely full!