Page 1 of 1

'Not' is not working

Posted: Wed Aug 02, 2006 7:01 pm
by drahneir
Hello,

when use 'Not' in my code it is believed to be a variable. And since I use 'EnableExplicit' nothing happens. Is this a bug just in my copy of PB4 or general ?
BTW, I use '~' as a replacement.

Thanks

Posted: Wed Aug 02, 2006 7:16 pm
by Jan Vooijs
What is not working?

NOT works really:

Code: Select all


EnableExplicit

Define Mess.l, Line.s

OpenConsole()

mess.l = #False
; mess.l = #True
Line.s = " test bla : bla test"

If Not Mess.l
	If FindString( Line.s, ":", 1)
		PrintN( "!!" + Line.s + "!!<o><o>")
	EndIf
EndIf

Input()

End
Uncomment and comment the two line and see for yourself.

Jan V.

Posted: Thu Aug 03, 2006 9:13 am
by drahneir
Hello Jan Vooijs,

thanks for your reply. Yes, your code works. But try this:

Code: Select all

wTune = #False

wTune = Not wTune
This leads to an error message. what's wrong with the code?

Regards

Posted: Thu Aug 03, 2006 9:34 am
by gnozal
drahneir wrote:Hello Jan Vooijs,

thanks for your reply. Yes, your code works. But try this:

Code: Select all

wTune = #False

wTune = Not wTune
This leads to an error message. what's wrong with the code?

Regards
NOT = LOGICAL NOT (use with IF/WHILE/UNTIL...)
~ = BITWISE NOT (use with numbers, like Flags = Flags & ~RemoveFlag)

Posted: Thu Aug 03, 2006 10:35 am
by drahneir
gnozal, thanks for your explanation.
Well, my application is a 1:1 translation from VB.NET (as far as possible), and thats why I was using the NOT-operator.

Regards

Posted: Thu Aug 03, 2006 3:45 pm
by Joakim Christiansen
You could use:

Code: Select all

wTune = #False

wTune = wTune!1

Posted: Sat Aug 05, 2006 9:32 pm
by Leonhard
or look this:

Code: Select all

Macro Is(Condition)
	(#False Or (Condition))
EndMacro

wTune = Is( Not #False)
Debug wTune

Missing boolean type

Posted: Sun Aug 06, 2006 2:43 am
by u9
Pure Basic has no boolean type so operations such as a = not b become a bit... daunting