IOS Learning Notes for loop method exercises--Lan Yi Education

Source: Internet
Author: User

Today I learned the For loop and the method, the content is somewhat complex, but original aim in the later study easy to grasp, because the scope is broad, the use rate is high. So you'll get it when you practice.

———————— for Loop ——————————

For Loop concept:

One of the statements in the For Loop programming language for loop execution. The For loop is open, and its general form is: for (; <<span se-mark= "1" > Conditional expression >;) statement; Initialization is always an assignment statement, which is used to assign an initial value to a loop control variable; a conditional expression is a relational expression. It determines when to exit the loop; increment defines how the loop control variable changes after each loop. Between these three sections with ";" Separate. For example: for (i=1; i<=10; i++) statements; In the above example, I was given an initial value of 1, to determine whether I is less than or equal to 10, if the execution of the statement, then increased by 1. Then re-judge until the condition is false, i.e. i>10, the end loop.

The For statement is more flexible than the while statement and Do-while, and is a larger, more commonly used loop statement with a general syntax format of:

for (expression 1; expression 2; expression 3)

{

Loop body

}

Where the expression can be omitted, but the semicolon must not be omitted.

?—————————— Method ————————————————

Class methods and Instance methods

The instance method is that the class begins with a + instance method that is accessed with an instance object, which is a class rather than an instance, typically creating an object or a tool class.

In the instance method, the message sent to self and super based on the principle of inheritance is actually sent to self

Inside the class method, self is the class method of the other class, and sending a message to self in a class method can only be a class method.

When to use a class method, to create an instance to get a shared instance, or to get some common information about the class

IOS Learning Notes for loop method exercises--Lan Yi Education

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.