Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Arrays TRUE when they're FALSE

Author
Message
Reece
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: UK
Posted: 23rd Oct 2002 02:21
very odd and again fundemental!

FRED(1)=0
If FRED(1) then print "cheese"

this prints cheese!
Reece
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: UK
Posted: 23rd Oct 2002 02:26
My entire DarkBasicV1 program is swarmed by hundreds of these array checks
It would take me many many tedious hours to change them to:

If FRED(1)=1

Is this a feature of DBPro??
Or another fundemental bug?
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 23rd Oct 2002 03:36
Seems to work in DBv1 but not DBPro, although it's something I never really tried before. Maybe this was one of those quirks that DBv1 allowed but wasn't a good programming standard. I don't know though. Surely it's better to use =1 or whatever anyway.
Thade!
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: Austria
Posted: 23rd Oct 2002 12:59
That is a bug
Reece
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: UK
Posted: 23rd Oct 2002 15:49
Hmm... Im wondering if this is an old fashioned way of programming or something. I learnt basic using AMOS for the Amiga so maybe Ive taken on bad habits?

I'm really enjoying DarkBasicV1 at the mo, especially with DarkEdit! I'm 2000lines of code into a program and its really stable.
I can only say...roll on patch 3!
Or rather patch 4,5 and 6!
The One Ring
21
Years of Service
User Offline
Joined: 15th Sep 2002
Location: United States
Posted: 23rd Oct 2002 16:32
Reece says: Hmm... Im wondering if this is an old fashioned way of programming or something.

Not exactly. Most languages today allow for shorthand boolean testing:

C/C++ - IF (someVar) { code... }
Delphi - IF NOT someVar THEN DO code...

This is a basic of expression handling.

AMD Athlon 900 768MB DDR
ATI Radeon 64MB DDR All-In-Wonder 7500, ATI XPert 128 16MB
Sound Blaster Audigy Gamer w/FireWire Support
Richard Davey
Retired Moderator
21
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 23rd Oct 2002 16:45
Not only that but DBPro itself allows this kind of expression testing. For example I never bother doing:

if spacekey()=1 then ...

I just do

if spacekey() then ...

because it's the exact same thing. You can get into real troubles when you always assume 0 is false and 1 is true, but it's useful too so it must be a bug of some description and I've already notified Lee about it.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming

Login to post a reply

Server time is: 2024-04-19 23:29:12
Your offset time is: 2024-04-19 23:29:12