
Coding else statements
In this piece of code an if statement and an else statement are used together. If the variable is under a certain value, the if statement code will run and an alert will pop up. If the variable is over the value, the else statement will run and a different alert will pop up. Using these two conditional statements in the same piece of code allows us to code a program that does different things depending on the variable.
See the Pen M2 CS Coding else statements by Walker Books UK (@walkerbooks) on CodePen.