Logic
Logic is the study of reasoning and when we add this to the control structures, they become algorithms.
Have you ever watered the plants using a water pipe or washed a car with it? How do you think it works?
The pipe guides the water from the water tap to the car. It makes sure optimum amount of water reaches the end of the pipe. A pipe is a control structure for water in this case. We will understand more about control structures in the next topic.
How does a control structure work?
Everything that we see around us, has a name. In a class, there are several students. When the teacher says I will give the prize to the best student. The student could be anyone in the class – Eric, Emily, Jonnathan, and so on.
We conclude, that the word student, is a variable.
Similarly, while starting to write code, we define a box, which can contain different values at different times, depending on the condition that we define. A control structure, defines the final value of the variables.
A precondition...