Loop Control Structures (while, do..while, for..in)
1. Introduction
After completing this module, you are expected to:
- Create corresponding loop statements to represent the iterative process.
- Use while, do while, and for..in statements to repeatedly execute codes.
While writing a program, you will encounter a situation where you would like to perform an action several times and in this instance this, you would get to use a loop statement to iterate through several lines of code. A loop statement is a control flow that executes a statement or a series of statements repeatedly while a specific condition is true. There are three types of loop statements; while statement, do/while statement, and for statement. JavaScript supports all the required loops to ease down the pressure of programming.
We are just going to look at the while, do while, and the for..in statements in this learning module.