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:
- Statements may only be obeyed under certain conditions (conditionals)
- Statements may be obeyed repeatedly under certain conditions (loops)
- A group of remote statements may be obeyed (subroutines)
Conditional Control Statements are divided in three types:
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.
You must log in to post a comment.