You may encounter situations, when a block of code needs to be executed several number of times. In general, statements are executed sequentially i.e. The first statement in a function is executed first, followed by the second, and so on. But in our programs, there may be a need of doing repetitive work which can be easily done with the help of loops.