87.0k views
1 vote
The while loop is referred to as __________ loop, because the loop condition is tested at the beginning of the loop.

User Olif
by
6.6k points

2 Answers

4 votes

Answer:

The while loop is referred to as a pretest loop because the loop condition is tested at the beginning of the loop.

Explanation:

A loop is said to be pretest if its block of code is to be repeated until the given condition becomes false and this condition is tested for before the block gets executed. In other words, in a pretest loop, the underlying condition is tested first and if it's true, the body of the loop gets executed.

PS: Another type of loop is the posttest loop which does the exact opposite of the pretest. An example of this type of loop is the do-while loop.

HOPE IT HELPED THANKS.

User Hbot
by
7.0k points
5 votes

Answer:

The while loop is referred to as a pretest loop because the loop condition is tested at the beginning of the loop.

Step-by-step explanation:

A loop is said to be pretest if its block of code is to be repeated until the given condition becomes false and this condition is tested for before the block gets executed. In other words, in a pretest loop, the underlying condition is tested first and if it's true, the body of the loop gets executed.

PS: Another type of loop is the posttest loop which does the exact opposite of the pretest. An example of this type of loop is the do-while loop.

Hope this helps!

User Wyatt Barnett
by
6.8k points