Java Programming: While Loop
The While loop checks a condition and executes when the result is "true" one or more statements. The condition is "false" is passed to the While loop to continue:
- Structure: while (condition) { //statement(s)}
- As long as the condition evaluates to true, the statement block runs.
- The condition is "false" is not executed, the statement block, and the program is managed according to the While statement to continue.
- Example: In our example, is tested in the condition is whether the Variable "a" is less than or equal to the number 100. As long as this is the case, "a" is output, and incremented by 2. The program thus gives all the even Numbers between 0 and 100.

Example of the While loop
If you have a condition only once on the "true" or "false" want to check, then try the If statement from.