mchack: I bought it.
only caught that it wasn't you because you talked yourself down like that.
"!= true" reads as "not true", no?
hmm, what would be the right syntax ... maybe "if x NOT true" ... or "if x false".
anyway it's c pseudo code isn't it? I have no Idea how you'd actually write it down, but I feel like I completely understood how bookwyrms code should run, so mission accomplished for pseudocode, right? :)
Bookwyrm627: Eh, he kind of has a point. That was really, really lazy pseudo code on my part, though it seems to have accomplished its objective.
A better formatted example would look more like this:
if(!shotTaken) {
Shoot();
} else {
AskOthersToShoot();
}
-The variable was obviously a boolean, so just use the 'not' on it directly in the if statement.
So... this company is helping us on a project, and they have a practice that in their code they ALWAYS include "true ==" or "false ==" in their conditionals. So for example they'd do:
if (true == condition) {
// stuff
}
Apparently it's good practice to spot any errors. And I have to agree that c
while (false == condition1 ||
false == condition2)
can be easier to read than
while (!condition1 ||
!condition2)
especially if going through someone else's code. Also it's in line with their policy of comparing a number to a variable
if (1 == var)
instead of
if (var == 1)
which makes it easier to avoid mistakes of putting = instead of == (the former won't compile in such a case, the latter will compile and lead to unexpected behaviour).
This last thing I've seen already before (though I don't use it myself since it's not an issue in C#). The adding of true or false is a new one.
You live and learn.