Lan Yi IOS Learning Note scope If judging bool variable

Source: Internet
Author: User

I'm from Lan Yi education.

The next day I learned the simple calculator subtraction, variables, bool variables, and if judgments. Better grasp of the situation.

First I learned a simple calculator. In the interface, enter two Uitextview to add numeric values, and four buttons below represent subtraction, then two labels for symbol display and calculation results. The graph is like this:

———————— The global variables that are subsequently learned ————————

The difference between a global variable and a local variable:

Global variables are variables that are valid throughout the source program, and local variables die after the end of the function or loop to which they belong. The entire program uses variables to define global variables, and if it is a function, define local variables so that other functions can redefine variables with the same name. If you use global variables, when you encounter a large program, the program is composed of different people to separate their own modules or functions, can not avoid the definition of the same name variable, will conflict.

BOOL Variable: BOOL is a Boolean variable, which is the definition of a logical variable, similar to float,double, except that float is defined as a floating-point type, and a double-precision floating-point type is defined.

———————— If Judgment ——————————

1. The first form is the basic form: if

An if (expression) statement

For example:

Ain () {

? int A,b,max;

printf ("\ n input, Numbers:");

scanf ("%d%d", &a,&b);

Max=a;

if (max

printf ("max=%d", Max);

}

2. The second form is: If-else

if (an expression)

Statement 1;

Else

3. The third form is if-else-if form

The first two forms of the IF statement are generally used for two branches of the case. When there are multiple branch selections, the IF-ELSE-IF statement can be used in the general form:

if (expression 1)

Statement 1;

else if (expression 2)

Statement 2;

else if (expression 3)

Statement 3;

...

Lan Yi IOS Learning Note scope If judging bool variable

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.