Is “else if” a single keyword?

后端 未结 8 1970
忘了有多久
忘了有多久 2021-01-31 01:13

I am new to C++. I often see conditional statement like below:

if 
  statement_0;
else if
  statement_1;

Question:

Syntacticall

8条回答
  •  孤街浪徒
    2021-01-31 01:43

    You can see the scope by using curly braces:

    if(X) {
      statement_0;
    }
    else {
      if(Y) {
        statement_1;
      }  
    }
    

    And normally implemented with two distinct keywords, one is if and one is else.

提交回复
热议问题