Ch. 5.9: Focus on Software Engineering: Deciding Which Loop to Use Flashcards

1
Q

When is the while ideal to use?

A

Ideal in situations where you do not want the loop to iterate if the condition is false from the beginning.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When is the do-while loop best to use?

A

It is ideal in situations where you always want the loop to iterate at least once.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When is the for loop best to use?

A

Is ideal in situations where the exact number of iterations is known.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly