[Gambas-user] strange problem with NOT
Jean-Francois Perreault
cmcpero at ...142...
Fri Mar 18 19:51:30 CET 2005
Hi,
I found this "problem" with NOT , I'm pretty sure VB doesn't behave this
way
for this code
DIM X as Integer
x = 1
PRINT "X is 1"
IF x = 0 THEN PRINT "x = 0 returned TRUE"
IF NOT x = 0 THEN PRINT "NOT x = 0 returned true"
IF NOT (x = 0) THEN PRINT "NOT (x = 0) returned true"
x = 0
PRINT "X is 0"
IF x = 0 THEN PRINT "x = 0 returned TRUE"
IF NOT x = 0 THEN PRINT "NOT x = 0 returned true"
IF NOT (x = 0) THEN PRINT "NOT (x = 0) returned true"
if you run this you'll get the surprising output
X is 1
NOT (x = 0) returned true
X is 0
x = 0 returned true
it's as if NOT was a function NOT() and not a logic keyword !
I'm pretty sure vb would have turned both
NOT x = 0 returned true
NOT (x = 0) returned true
(that is if VB had a PRINT function ;) )
I don't have vb installed right now so I can't test , but that
behavior sure puzzled me in the form of a bug in my program !!!
---
Jean-Francois Perreault
More information about the User
mailing list