Joke Collection Website - Mood Talk - I'll tell you why people would rather see 0.

I'll tell you why people would rather see 0.

The difference is obvious!

Let's talk about the if branch structure first!

If(express) statement 1

Else statement 2

When express is true, the statement 1 is executed, and when express is false, the statement 2 is executed. Obviously, it can only be one statement, so if you want to use more than one statement, you must use {} to represent the statement block!

Look back.

If(express 1) statement 1

Else if(express2) statement 2

Else statement 3

Because an if structure can be called a compound statement! So, in this nested if, the second if is a statement, so, and.

If(express 1) statement 1

If(express2) statement 2

Else statement 3

Obviously different!

The former is a statement with the second if as the else branch of the first if, and the latter is a compound statement with two if branches in parallel!