For Loop dual variables, for variables

Source: Internet
Author: User

For Loop dual variables, for variables
For Loop double variable 1: Introduction
Usually, the for loop is as frequently as a slap in the face. Today, the for loop gets stuck and remains a layer of for loop. As follows:

public class CommaForLoop{public static void main(String[] args){for(int i = 1, j = i + 10; i < 5; i ++, j = i *2){System.out.println("i = " + i + " j = " + j);}}}

Ii. Analysis
No. You may try running it on your machine and give the result. An execution process with results. Have you ever been confused with me...
Summary:
The most familiar unfamiliar for is that it is OK to be careful. Today, you can open your computer, start the project, access the project, be stupid, and there is no page shown... A variety of tangle for an hour. Finally, it is found that a pair of <title> xxx </title> in jsp is changed to <title> xxx </titEel>. The little hand shakes and the page does not exist. Careful and careful, each step well considered, cannot simply pursue fast. Sometimes it is counterproductive.
What are the differences in the for loop control variables?

Only 2nd of the three conditions of a for loop are meaningful conditions, and the other two are auxiliary conditions, such:
For (I = 0; I <3; I ++) {x ++ ;}
This can actually be written.
I = 0;
For (; I <3;) {x ++; I ++ ;}
Similarly, the loop code in your problem is only related to the condition of loop bounce.

The execution process is
First time: x = 10 y = 10 output 1010
X auto-subtraction, y = ++ I
Second time: x = 9 y = 1 Output 91
X auto-subtraction, y = ++ I
Third time: x = 8 does not meet the condition to jump out of the loop

Variable problems in matlab dual-cycle

Sum (f (I,), which can be called in sequence.

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.