Page 1 of 1
Posted: Wed Oct 02, 2002 2:18 pm
by BackupUser
Restored from previous forum. Originally posted by flim.
I found I can use And Or Xor but not 'Not', will this add in next update?
Posted: Wed Oct 02, 2002 3:21 pm
by BackupUser
Restored from previous forum. Originally posted by fred.
'Not' for now
Fred - AlphaSND
Posted: Wed Oct 02, 2002 4:19 pm
by BackupUser
Restored from previous forum. Originally posted by fweil.
Just for fun !
Procedure.l Not(a.l)
ProcedureReturn 1 - a
EndProcedure
;
;
;
a.l
a = #TRUE
Debug Not(a)
Debug Not(Not(a))
Francois Weil
14, rue Douer
F64100 Bayonne
Posted: Wed Oct 02, 2002 6:33 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.
fweil, the OP requested a logical NOT.
What you do is a BINARY not, and thats already
implemented in PureBasic:
a = ~a
a ~a
example:
ALL bitwise stuff in PureBasic is a special character:
AND: &
OR : |
XOR: !
NOT: ~
All WORDS ("Or", "And") are logical things that
compare something and return only 0 or 1, TRUE or FALSE.
cya,
...Danilo
(registered PureBasic user)
Posted: Wed Oct 02, 2002 7:28 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Here's a logical Not operator procedure;)
Code: Select all
Procedure Not(a.l)
ProcedureReturn (b Or a=0)
EndProcedure
Debug Not(0)
Debug Not(12)
Posted: Wed Oct 02, 2002 8:35 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.
How can you write " If x = 12 Not b = 13 " with that ??
cya,
...Danilo
(registered PureBasic user)
Posted: Wed Oct 02, 2002 10:08 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Originally posted by Danilo
How can you write " If x = 12 Not b = 13 " with that ??
How can you evaluate that in ANY language, NOT is a one argument operation. You'll get syntax error for sure with that expression! This would be a correct way to use NOT:
If x=12 And Not b=13
But as PB produces assembly errors when passing something like 'a=13' to a procedure we have to use a trick, same trick as in the procedure actually, so to get this to work you would have to do it like this:
if x=12 And Not(0 or b=13)
Agreed it's not very good, i didn't mean for anyone to actually use it in their code, better to wait for the real thing!