A do-while loop is more appropriate than for loop when.

google ads 1

A do-while loop is more appropriate than for loop when:

The program will be executed more than one time

The terminating condition occurs unexpectedly

The number of times the loop will be executed is known before the loop is executed

The body of loop will be executed at least once

Google Ads