We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a28193 commit efe3f1cCopy full SHA for efe3f1c
exercises/basicTypes/basicTypes.cpp
@@ -45,7 +45,7 @@ int main() {
45
bool condition1 = false;
46
bool condition2 = true;
47
print( alwaysTrue && condition1 && condition2 );
48
- print( alwaysTrue || condition1 && condition2 ); // Q: Why does operator precedence render this expression useless?
+ print( alwaysTrue || condition1 && condition2 ); // Q: Are this and the following expressions useful?
49
print( alwaysTrue && condition1 || condition2 );
50
print(condition1 != condition1); // Q: What is the difference between this and the following expression?
51
print(condition2 = !condition2);
exercises/basicTypes/solution/basicTypes.sol.cpp
@@ -45,8 +45,9 @@ int main() {
- print( alwaysTrue && condition1 || condition2 ); // A: "true || " is evaluated last. The expression therefore is always true.
+ // A: Not really. Since we use "true ||", it is always true.
+ print( alwaysTrue && condition1 || condition2 ); // A: "true && condition1" is the same as "condition1"
52
print(condition2 = !condition2); // A: The first is a comparison, the second a negation with subsequent assignment
53
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments