You are viewing a single comment's thread. Return to all comments →
Ah, the good old if (cond) return true; else return false; :)
if (cond) return true; else return false;
Do you have a specific reason to do this? (The first time I wrote similar to this (at uni) I literally LOL'd at myself when noticed.)
if (!expressionStack.empty()) return false; return true;
which is the same as (inverted)
if (expressionStack.empty()) return true; /*else*/ return false;
which is the same as (simplified)
return expressionStack.empty();
(If you use an IDE like IntelliJ IDEA it should warn you about these with inspections and you can fix the via a quick fix.)
Seems like cookies are disabled on this browser, please enable them to open this website
Stacks: Balanced Brackets
You are viewing a single comment's thread. Return to all comments →
Ah, the good old
if (cond) return true; else return false;
:)Do you have a specific reason to do this? (The first time I wrote similar to this (at uni) I literally LOL'd at myself when noticed.)
which is the same as (inverted)
which is the same as (simplified)
(If you use an IDE like IntelliJ IDEA it should warn you about these with inspections and you can fix the via a quick fix.)