Define What is Loop and what are the Types with Syntax.

In this tutorial i’m going to define what is loop and what are the types with syntax.

What is Loop?

Any Repeated task more than one time that is called Loop. In a loop structure, the loop asks a question. If the answer requires action, it is executed. Using loops in computer programs simplifies rather optimizes the process of coding.

Types of Loops?

  1. While Loop.
  2. Do while Loop
  3. For Loop

While Loop:- While loop is a pre-test loop. It first test a specified conditional expression and as long as the condition true action taken. While loop also known as Entry Control Loop

Syntax with example:-

OutPut 👇

2. Do while Loop:- Do while loop is similar to while loop but the condition is checked after the loop. This ensure that the loop body is run at least once.

OutPut 👇

3. For Loop :- The for is frequently used usullay where the loop will be traversed a fixed numbers of times. A loop variable is used to control the loop

Syntax + example:-

OutPut 👇

Thanks …

Hi I am Amit Experienced Web Developer with a demonstrated history of working in the information technology and services industry.