Conditional Control Statements

Most programming languages have control flow statements (constructs) which provide some sort of control structures that serve to specify order to what has to be done to perform our program that allow variations in this sequential order:

  1. Statements may only be obeyed under certain conditions (conditionals)
  2. Statements may be obeyed repeatedly under certain conditions (loops)
  3. A group of remote statements may be obeyed (subroutines)

Conditional Control Statements are divided in three types:

  1. Decision making statements
  2. Switch case control statement
  3. Loop control statements or repetitions

It can actually be argued that there is no meaningful human activity in which no decision making, instinctual or otherwise, takes place.

For example, when driving a car and approaching a traffic light, one does not think, “I will continue driving through the intersection. Rather, one thinks, I will stop if the light is red, go if the light is green, and if yellow go only if I am traveling at a certain speed a certain distance from the intersection. These kinds of processes can be simulated using conditionals.

A conditional is a statement that instructs the computer to execute a certain block of code or alter certain data only if a specific condition has been met.

Related posts