[Implemented] not logical operatior, break, continue

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Implemented] not logical operatior, break, continue

Post by BackupUser »

Restored from previous forum. Originally posted by flim.

Please add these in next version please :cry:
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Hawklord.

So, I'm not the only one missing "NOT" logical operator ? :wink:
Yes, I know logical expressions always may be formulated to avoid "NOT",
but doing this really can make a code passage unclear and hard(er) to understand
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> So, I'm not the only one missing "NOT" logical operator ? :wink:

http://www.purebasic.com/documentation/ ... ables.html


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

Post by BackupUser »

Restored from previous forum. Originally posted by plouf.

hm ? afaik (and according the manual)
there is no NOT operator not a way
and as hawklord said you can avoid it
but it would be nicer to have it [;-)]

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

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> there is no NOT operator

There is a NOT operator, but there isn't a NOT statement/command.
Yes, there is a difference.


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

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

the topic says the logical not operator

pb has the bitwise not , but not the logical not
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Okay, I was wrong (again).


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

Post by BackupUser »

Restored from previous forum. Originally posted by TheBeck.

~ <- Comparison not (in manual)
Not <- Logical not (not in manual)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by plouf.

there isn't in the manual because it is not supported yet
can you do this ?
if Not initkeyboard() ?

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

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

maybe i'm wrong but does not the logical not only change from true to false and viceversa?

if so you can use this:

procedure not(var.l)
if var : procedurereturn 0
else : procedurereturn 1 :endif
endprocedure

if not(InitKeyboard())
messagerequester("","error",0)
else
messagerequester("","ok",0)
endif
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tinman.
Originally posted by Justin

maybe i'm wrong but does not the logical not only change from true to false and viceversa?
Yes, that is what it would do and your code should work. However, most people would prefer to have an operator than a function (1-3 asm instructions instead of ???? + branching).

I guess you could use it as a stopgap. You should also be able to use the bitwise not operator as a logical not operator but ONLY with results of comparisons (safely) e.g.:

If ~(foo=bar)
...


--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + SP1, PB3.40)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

i also prefer to have it as an operator i hope fred will include it
Post Reply