I believe that all of you, while studying C, have learned this syntax:
if (condition 1) {
statements
} else if (condition 2) {
statements
} ...
else {
statements
}
But after reading N1570, § 6.8.4.1 Operatorif , I absolutely do not say anything about encoded operators else if, unlike other languages that provide keywords for this, such as ElseIfor elif.
In my opinion, the whole if(...){...}else{...}is one single statement (a sentence elsemay not exist, which does not matter). Therefore, when it comes to parsing, as shown in the codes below,
if (condition) {}
else
one_statement;
if (condition) {}
else
if (something else) {} else {}
- if one_statement; "" "unit".
, C , , . ,
if (condition) {
} else if (something else) {
} else {
}
?