Picture by Moyan Brenn on Flickr.
Picture by Moyan Brenn on Flickr.

This post is for mastery points 15 and 16:

So this time it is about conditional if and using else with a conditional

As you may know, an if statement is a fairly simple conditional, yet you can do very interesting things with it. It’s different from a for cycle because with the if condition you only write one parameter. If the parameter is true then the condition is met and the programm performs the piece of code under de condition.

Using else is useful when you have two situations. If the condition is not met in the previous if, then the code under de else statement is going to be performed. As I said, the if statement works with true or false, therefore you could say that an if statements works based on boolean algebra.

The following video is me talking a little about if statements and using else with it. 🙂


CC BY 4.0 Mastery 15 & Mastery 16 by Octavio Rojas is licensed under a Creative Commons Attribution 4.0 International License.