New course! Every coder should learn Generative AI!
Try a free lesson+ 1
Can you explain me how they are different?
int i=0; while(i<=10){ // Something } int i=0; do{ // Something }while(i<=10);
1 Answer
+ 2
Just to add to Serena Yvonne's answer, there is a chance that statements within a while loop won't be executed if the condition is not met. On the other hand, a do-while loop guarantees that the loop will execute at LEAST once.