Current location - Plastic Surgery and Aesthetics Network - Clothing company - Is there a difference between else if and else{if}?
Is there a difference between else if and else{if}?
else if (xxxxx)

xxxxxxx

else xxxxxxxxx

If else goes on like this, there can only be one if and one else, and nothing else, otherwise it will be beyond the scope of the first else, and then it will be over.

Chestnuts:

else if(b & gt; answer

xxxxxxxxxx

else xxxxxcc

Otherwise, if (b> answer

xxxxxxxxxx

else if (xxxxx)

xxxxcccc

Go on like this. If so

else if(b & gt; answer

xxxxxxxxxx

else xxxxxcc

s = s+a;

Then s = s+a; Not from the original else.

Else {ifxxxxxxxxxxxx} ends else. Everything in {} is the content of this else, and there can be many contents, without an if and an else.

Chestnuts:

Otherwise {

If (xxxxxxx)

xxxxcccccc

xxxxxxcccc

xxxxxxxxxxxxcc

}

The content in {} is the range of the first else.