This paper mainly to you about Visual Basic For loops in the structure and usage.
Format:
The following is quoted fragment:
For <cycle initial variable> = <> To <final step Step> []
<Loop>
[Exit For]
Next <cycle variables>
Features:
When the cycle variable in the value of the initial value of the end, the implementation of a cycle of the blocks, and add a preliminary step. When the value of variable cycle is not the end of the initial range, they withdraw from the cycle of the implementation of Next behind the statement. For loop implementation of the flow chart.
Description:
(1) <cycle variable>: also known as cycle control variables, it is a numerical variable, but not a Boolean or array elements.
(2) <initial>, <final step> and <>: they are a numerical expression. Step-positive, said increasing circulation; step is negative, that reduced cycle, but not for o. Step l for the default values.
(3) <cycle of>: For Next statements and statements between statements sequence, it could be one or more statements.
(4) [Exit For]: If this option, withdraw from the cycle.
(5) Next: Cycle terminal statement in the back of Next For cycle variables and expressions in the cycle of variables must be the same. When only one cycle, the cycle of Next behind variables can be omitted not written.
(6) For the statement also called cycle statements, designated cycle variables used to the name, as well as the initial cycle variables, and the final step; cycle is repeated in the part of the implementation (ie cycle), it can be some of the statements by the composition; Next, the statement also called terminal statement cycle, and its role is to change the value of variables cycle (that is, an additional step), and once again the implementation of the control loop.
(7) the number of the implementation cycle: n = Int ((end an initial value) / step) +1
(8) For Next statement can be nested-use, there is no restriction on the number of storeys nested, and the basic requirement is: there is only one of each cycle, as the only variable cycle variables; inner circle variables Next statement must be placed on the upper cycle variables Before the Next statement. |