Once heard a word: "The computer is good at doing the work is ' cycle '!" ”。 Indeed, cyclic execution plays a very important role in language, and we can achieve more complex and repetitive work by using loops. Easy language for the circulation of the structure of the four forms, the following together to understand the easy language of the cycle structure of the specific use of the method.
Method/Step
In this small series will be an example of the method to share the language of the cycle structure of the specific use of: first create a Windows blank window, drawing as shown in the human-machine interface.
Next, add a "clicked" Event for the Calculate button.
We first use the "Judgment loop" structure to compute N-order:
In the Assembly window, enter the code as shown in the illustration. The use of the "judging cycle" structure is: when the condition in the "Judgment Cycle Head" is true, the statement in the loop body executes the next statement of "Judgment loop tail" automatically when the condition is false.
Finally run the program, test results output:
Let's take a look at the use of the "cycle first" structure:
The first argument in the cycle head represents the number of loops, and the second argument is optional, representing the number of current loops, which can be used to record the number of times the loop has been cycled.
Enter the following code and run to get the result output:
How to use the variable loop structure:
The "variable loop" structure has four parameters,
The first argument is "variable starting value."
The second argument is "variable target value", which is the end value of the loop.
The third argument is "variable increment", which specifies the number of times the variable is incremented each time.
The fourth parameter is the loop variable itself, which is used to store the current value of the loop variable for Each loop.
When the loop condition is false, the statement following the "end of the variable loop" is executed.
Enter the code as shown and run, and you can see the results:
The last small series of "variable cycle first" to write a "99 multiplication table", you can refer to:
Small partners whether the easy language of the circulation of the structure of the understanding of the, I hope this article on the study can help.