Showing posts with label Entry controlled loop. Show all posts
Showing posts with label Entry controlled loop. Show all posts

What are the entry controlled and exit controlled loops?

Loops in computer programs refers to a block of code that is executed over and over based on meeting some criteria or condition. However a loop can be broke or exited from inside the loop also. The block of code in a loop keeps on executing again and again unless it meets a certain condition or being exited explicitly from inside the loop. Thus, if not well-conditioned a loop might keep on running causing the program to fail ultimately.

Depending on the position of the control statement in the loop, loops can be of two types
  1. Entry Controlled 
  2. Exit Controlled
Beside this, loops can be categorized in to two other categories called counter controlled loops and sentinel controlled loops based on the nature of the control variables and the kind of value assigned to them. You can lean more about counter and sentinel controlled loops here and learn more about the differences between counter and sentinel controlled loops here.