10-31 notes

Three elements of circulation

Condition variable
Condition judgment Make
appropriate modifications to the condition variable in the loop.
Example
Debug mode
function
allows us to view the data value of the variable in slow motion, and
allows us to see the running track of the code.
Usage
Break point
Break point
debug where you need to pause Run
Right click the mouse and select debug. . . .
A bright horizontal line will appear,
representing the line of code to be explained and executed

Code

Loop condition
Normal loop.
Currently we are playing normal loop.
Zero loop. The
loop condition is not met
at the beginning
. No loop is executed . Infinite loop, infinite loop.
Loop condition is permanently established.
Repeated execution of code
do...while loop
Syntax
while vs do...while
difference
while There is a zero loop
do…while there is no zero loop
Application scenarios
do…while…
do things first, then check and accept

Example
do...while
while
for loop
Syntax
Format
Example
Execution process Pay
attention to the execution process
of the
for loop The difference between the three loops for is
more suitable for a specified number of loops
For example, loop printing n times
while
first judges the condition, and then repeats
do...while
first executes repeat And then determine whether to continue to repeat the
output 1 to 10 three kinds of cycles

Guess you like

Origin blog.csdn.net/weixin_51734251/article/details/109427014