How to use for Loop statement nesting method
How to use for loop statement nesting method, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
For loop syntax:
For (expression 1; expression 2; expression 3)
{
Cyclic body
}
The loop starts with expression 1-expression 2 (discriminant expression)-true-execution loop body-expression 3-judgment expression 2
True: continue-loop body-expression 3-expression 2
False: jump out of the loop (normally, the exit of the for loop is expression 2)
Exercise: use the for loop to find the sum of 1-100?
The transformation form of for cycle
Loop factor: a, defined before the for loop, can still be used after the end of the for loop.
B. Within a defined for loop, after the for loop ends, you cannot use the
For (int I = 1; I