Page 1 of 1

comparison operators behaving oddly

Posted: Sat Jun 14, 2008 3:37 pm
by veganisafreak
This is on Windows and Linux. I'm not posting it in the bug reports in case it's not a bug but...

Code: Select all

a.l
b.l

a = 1

b = a <> 1

Debug b

End
Shouldn't this debug 0 or "False"? I noticed this when I was converting a program from Blitz Basic and it didn't work.

Re: comparison operators behaving oddly

Posted: Sat Jun 14, 2008 3:52 pm
by Demivec
veganisafreak wrote:This is on Windows and Linux. I'm not posting it in the bug reports in case it's not a bug but...

Code: Select all

a.l
b.l

a = 1

b = a <> 1

Debug b

End
Shouldn't this debug 0 or "False"? I noticed this when I was converting a program from Blitz Basic and it didn't work.
PureBasic only allows comparison operators in 'If/ElseIF/EndIf' and in the expressions of the 'While/Wend' and 'Repeat/Until' commands. It is also possible to sneak them in a few other places, though it is unsupported and must be done carefully.

With your example, the value displayed by Debug is the right side of the expression 'a <> 1' because conditionals aren't supported in an assignment statement. This means it is not a bug, you're expecting the code to do something that is unsupported at this time.

Look here for some discussion on unsupported tricks to sneak comparisons into other places (for now). :wink:

Re: comparison operators behaving oddly

Posted: Sat Jun 14, 2008 4:59 pm
by veganisafreak
Hi,

Thanks for the quick reply. PureBasic certainly is an idiosyncratic language. I guess I should have tried the demo, but I can't stand crippleware. I bought it on the basis that there are so many satisfied customers... and I hear it was spawned by Blitz... well I'm fairly happy so far anyhow. :D

Re: comparison operators behaving oddly

Posted: Sat Jun 14, 2008 5:20 pm
by Demivec
veganisafreak wrote:Hi,

Thanks for the quick reply. PureBasic certainly is an idiosyncratic language. I guess I should have tried the demo, but I can't stand crippleware. I bought it on the basis that there are so many satisfied customers... and I hear it was spawned by Blitz... well I'm fairly happy so far anyhow. :D
Once I tried it I knew it was the language I was looking for. The idiosyncracies took a little bit of time for me to get use to, but that is true of anything. I was most challenged by the terminology used to described different aspects of the language, not by the language itself.

As you become more familiar with the language you will find there is a great deal of information on these forums. If you search you will often find that something you're interested in has been discussed (and just as often, solved) many times already. :wink:



@Edit: ...a belated welcome also. :D

Re: comparison operators behaving oddly

Posted: Sat Jun 14, 2008 5:22 pm
by rsts
veganisafreak wrote:Hi,

I bought it on the basis that there are so many satisfied customers... . :D
I believe you won't be disappointed. It's a fabulous language at a very reasonable price.

And a somewhat belated "Welcome" :)

cheers

Re: comparison operators behaving oddly

Posted: Sat Jun 14, 2008 5:54 pm
by veganisafreak
Thanks a lot both of you for the warm welcome. :D

My favourite thing about PB so far is the freedom - it doesn't try to shelter the user from all the pointer/assembly type stuff like BB used to... BB was so restricting... and I took one look at BlitzMax and thought the syntax was a mess - it looked like it was trying to be three different languages at once - BASIC, Pascal and C++. Urgh.

Having said that, I don't think PB is as "BASIC" as it could be. I imagine if I didn't know what a pointer/array was... I would read the manual and still not know. Could be quite offputting for beginners. There should be an "absolute beginners" tutorial included.

PS Sorry for not searching the forum for my operators question. I guess I am impatient sort of person. :P

Posted: Sat Jun 14, 2008 6:21 pm
by Kaeru Gaman
the pointers topic is only ~mentioned~ in the Manual, and it's said "for experienced users".
the thing is, playing with pointers is nothing for beginners, so it would be in the wrong place in an "absolute beginners" manual.

it would be a nice topic in a "so, now I am advanced, now I can start messing with pointers and programming my last nerve off"-tutorial.. ;)

Posted: Sat Jun 14, 2008 6:44 pm
by veganisafreak
Point taken.

Posted: Sat Jun 14, 2008 6:53 pm
by blueznl
Go here:

http://www.xs4all.nl/~bluez/datatalk/pu ... xpressions

It's something I started writing as I had some 'adjusting' to do as well, coming from another basic dialect (GfaBasic).

However, PureBasic has definitely surpassed GfaBasic.

But... PureBasic is NOT C(++) so some things may differ, and assinging the result of an evaluation to a variable is simply not supported.