Introduction to Conditional Statements
Learn what conditional statements are and why are they used.
We'll cover the following...
The need for conditional statements
Often, we take action based on the circumstances around us. This is called decision making. For instance, if the weather is hot, we might drink a cold beverage like a milkshake, and if the weather is cold, we might choose to drink hot chocolate.
Similarly, we want our computer programs to decide what action to take depending on the result of a condition(s). This is where conditional statements like IF, IF-ELSE, and IF-ELSE-IF come into play.