SPIN IF Condition execution...
Rayman
Posts: 14,793
Anybody know if the SPIN IF command processes all it's conditions or aborts on the first false one?
E.g., if I have two methods (doThis(x):bOk, doThat(y):bOk) that return a boolean and I have
IF·doThis(x) AND doThat(y)
·· ...
And, it happens that doThis(x) returns false.· Will the doThat(y) method still be called?
I know that in C++ it wouldn't be.· But, the manual wasn't terribly clear about this...
Also, are these processed in the order their written?· (I assuming that doThis(x) would be called first, but I guess it not necessarily a given...)
E.g., if I have two methods (doThis(x):bOk, doThat(y):bOk) that return a boolean and I have
IF·doThis(x) AND doThat(y)
·· ...
And, it happens that doThis(x) returns false.· Will the doThat(y) method still be called?
I know that in C++ it wouldn't be.· But, the manual wasn't terribly clear about this...
Also, are these processed in the order their written?· (I assuming that doThis(x) would be called first, but I guess it not necessarily a given...)
Comments
There's an advantage to not documenting this in that Parallax can change it in the future without breaking existing programs.
It is possible that short-circuit evaluation could be added in the future, but the compiler doesn't even optimise away "+0" at present and adding it would likely break a lot of existing code.
Hippy: Do you have some kind of SPIN decompiler?
You missed it !?
http://forums.parallax.com/showthread.php?p=665019
Enjoy