The difference between while and do while

1. While: first judge the loop condition, in the execution of the loop body, if the loop condition is not established at the beginning, then the loop body will not be executed
2. do while: execute the loop body first, and judge the loop condition; regardless of whether the loop condition is established, The body of the loop will be executed at least once

Guess you like

Origin blog.csdn.net/jq1223/article/details/112727051