4.9k views
2 votes
Discuss why you would use a for loop versus a while loop.

1 Answer

4 votes

Answer: In general, you should use a for loop when you know how many times the loop should run. If you want the loop to break based on a condition other than the number of times it runs, you should use a while loop.

Step-by-step explanation:

User Abel Osorio
by
7.7k points