- #1
elusiveshame
- 169
- 35
Hey everyone, I have a logic question, though I'm not sure if this might belong in the math forum (probably not :P)
Anyway, I'm writing a BASIC compiler for the Motorola 68k processor by reverse engineering a dead project/compiler (with permission from the author as he's abandoned it years ago). Anyway, I've into an interesting conundrum. I've gotten to the logic operators, and was wondering what the proper output should be when it comes to inequalities.
The example I'm working with is: a <> 5 <> b
Assume both a and b are both equal to 0. Since both variables don't equal 5, it should return true, right?
The code I was testing with is:
if a <> 5 <> c then print "True"
In the abandoned compiler, this returns false and doesn't print "true" to the screen (actually, even if both variables are different values and not equal to 5, it returns false). I'm going to assume that's not the correct output, and should return true unless both variables don't equal the middle term, right?
Thanks! :)
Anyway, I'm writing a BASIC compiler for the Motorola 68k processor by reverse engineering a dead project/compiler (with permission from the author as he's abandoned it years ago). Anyway, I've into an interesting conundrum. I've gotten to the logic operators, and was wondering what the proper output should be when it comes to inequalities.
The example I'm working with is: a <> 5 <> b
Assume both a and b are both equal to 0. Since both variables don't equal 5, it should return true, right?
The code I was testing with is:
if a <> 5 <> c then print "True"
In the abandoned compiler, this returns false and doesn't print "true" to the screen (actually, even if both variables are different values and not equal to 5, it returns false). I'm going to assume that's not the correct output, and should return true unless both variables don't equal the middle term, right?
Thanks! :)