while loop
Features: First judge the loop condition, and then judge whether the loop body is looping according to the condition.
while (loop condition) { loop operation }
do...while loop
Features: execute first and then judge. First execute the loop body and then judge whether the loop condition is satisfied according to the value of the variable. It must be executed at least once.
do{ loop operation }while (loop condition);
to sum up
Program debugging
Finding program errors through code reading or adding output statements
When the program structure becomes more and more complex, special techniques are needed to find and locate errors, which is the "program debugging"
debugging step.
Step 1: Analyze errors and set breakpoints.
Step 2: Start debugging
Step 3: Single-step operation After
debugging is started, the line of code that runs to the set breakpoint will stop.
Press F6 to run the program in a single step and observe the running process of the program.
Step 4: Observe the variable in
single-step operation and you can view it in the "Variable" view Go to the current value of the variable
Step 5: Find the problem