201k views
4 votes
Choose the word that makes each sentence true.

Use a while/for loop when you know you want to make 10 passes through a loop
Use a while/for loop when you want to continue passing through a loop until a condition is met

1 Answer

9 votes

Answer:

Use a for loop when you know you want to make 10 passes through a loop

Use a while loop when you want to continue passing through a loop until a condition is met

Step-by-step explanation:

Let us first clear that when do we use for loop and when do we use while loop.

For loop is used when the programmer already knows the number of repetitions.

While loop is used when the number of iterations are not known but the condition has to be used to determine the number of iterations.

Hence,

Use a for loop when you know you want to make 10 passes through a loop

Use a while loop when you want to continue passing through a loop until a condition is met

User Phoenix Bird
by
6.2k points