Easy Language Basic course of circulation Program Structure _ Easy language

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.