Conditional statements in programming languages are the primary way in which the execution flow of a program is controlled. Without conditional statements, execution flows from top to bottom within a function or method: one statement after another. Conditional statements allow a program to decide which statements to skip or when a block of statements should be re-executed.
In order to understand conditional statements, students must also understand conditions. The most fundamental condition is the “yes/no” condition: Should I execute this block of statements or not? Yes or no. Boolean logic is a formal notation for expressing and analyzing such two-valued questions and, not surprisingly, is the basis for conditional statements in programming languages.
These are the posts that make up the “Conditionals” materials: