A program is a solution specific to a problem. The solution we write is broken down to different tasks. Tasks can be specific to a step or a part of the solution. While coding for such tasks, we use constructs as tools to make them easier, readable, and performant. These tools make it possible to shape up your program at hand.
To code for a task that is repetitive requires either a construct that can repeat a given logic for you, ...