'Not' is not working

Just starting out? Need help? Post your questions and find answers here.
drahneir
Enthusiast
Enthusiast
Posts: 105
Joined: Tue Jul 18, 2006 4:18 pm
Location: JO42RM

'Not' is not working

Post 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
Jan Vooijs
Enthusiast
Enthusiast
Posts: 196
Joined: Tue Sep 30, 2003 4:32 pm
Location: The Netherlands

Post 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.
Life goes to Fast, Enjoy!!

PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!

AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
drahneir
Enthusiast
Enthusiast
Posts: 105
Joined: Tue Jul 18, 2006 4:18 pm
Location: JO42RM

Post 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
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
drahneir
Enthusiast
Enthusiast
Posts: 105
Joined: Tue Jul 18, 2006 4:18 pm
Location: JO42RM

Post 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
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

You could use:

Code: Select all

wTune = #False

wTune = wTune!1
I like logic, hence I dislike humans but love computers.
Leonhard
User
User
Posts: 55
Joined: Fri Jun 16, 2006 7:43 am

Post by Leonhard »

or look this:

Code: Select all

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

wTune = Is( Not #False)
Debug wTune
u9
User
User
Posts: 55
Joined: Tue May 09, 2006 8:43 pm
Location: Faroe Islands
Contact:

Missing boolean type

Post by u9 »

Pure Basic has no boolean type so operations such as a = not b become a bit... daunting
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents. (Nathaniel Borenstein)
http://www.wirednerd.com
Post Reply