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?
Not command is missing?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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)
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:
Code: Select all
a ~1MessageRequester("",Hex(a),0)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)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
Here's a logical Not operator procedure;)
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)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
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!
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:Originally posted by Danilo
How can you write " If x = 12 Not b = 13 " with that ??
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!