Tag: operator loop operation ALS Statement while performing a differential expression
While syntax format:
while (Boolean expression) {
Statement
}
Judge the Boolean expression first, if true executes the statement in the loop body, and then the Boolean expression, if true, executes the statement in the loop body, until the Boolean expression is false, and then the loop ends.
Usually with arithmetic operator (+ +--decrement)
Do/while Syntax Format:
bo=
Statement
}while (boolean expression);
Executes the loop body first, then determines whether the Boolean expression is true, and if so, resumes execution of the loop body, judging the Boolean expression until false to end the loop.
The difference between the two: while is the first judgment in the execution if the judgment is not established, will not be executed; Do/while is executed first in judgment, regardless of whether the judgment is established.
A brief analysis of the difference between while loop and Do/while loop in Java