Definite Loops vs Indefinite Loops

Loops are categorized into two types:

  • Definite Loops
  • Indefinite Loops
Definite Loops:

Loops which run for a specific number of times are called definite loops. Before starting the loop, it is already known on the times the loop has to run. For example, if programmer wants to print numbers from 0 to 10. for loop is an example

Indefinite Loops:

Loops which are run based on a condition. For example, if the loop has to run on 'n' number of times and 'n' is based on a condition. while loop is an example.

Post a Comment

0 Comments