79766953

Date: 2025-09-17 06:29:23
Score: 1.5
Natty:
Report link

You can change a while loop to a do-while loop by moving the condition check to the end. The body remains the same, but do-while ensures the code runs at least once:

int i = 1;
do {
    System.out.println(i);
    i++;
} while (i <= 5);

So the only difference is when the condition is checked — while checks first, do-while checks after execution.

Learn more: https://youtu.be/lA4q9UZR53c?si=lO2ks5wwI37BZL3n

Reasons:
  • Blacklisted phrase (1): youtu.be
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Quipoin