Page 1 of 1

[Implemented] not logical operatior, break, continue

Posted: Sun Oct 13, 2002 1:55 pm
by BackupUser
Restored from previous forum. Originally posted by flim.

Please add these in next version please :cry:

Posted: Thu Nov 14, 2002 11:43 am
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

Posted: Thu Nov 14, 2002 12:17 pm
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

Posted: Thu Nov 14, 2002 5:02 pm
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

Posted: Thu Nov 14, 2002 6:13 pm
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

Posted: Thu Nov 14, 2002 6:32 pm
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

Posted: Thu Nov 14, 2002 6:55 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

Okay, I was wrong (again).


PB - Registered PureBasic Coder

Posted: Fri Nov 15, 2002 1:41 am
by BackupUser
Restored from previous forum. Originally posted by TheBeck.

~ <- Comparison not (in manual)
Not <- Logical not (not in manual)

Posted: Fri Nov 15, 2002 12:21 pm
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

Posted: Fri Nov 15, 2002 6:49 pm
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

Posted: Fri Nov 15, 2002 7:56 pm
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)

Posted: Fri Nov 15, 2002 8:19 pm
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