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.

Author
Message
Jac
20
Years of Service
User Offline
Joined: 9th Nov 2003
Location:
Posted: 6th Oct 2004 06:18 Edited at: 6th Oct 2004 06:19
Hi.

I'm using 'array index at top a()' and 'next array index a()' to create an interchangeable list, see below



Then later in the code, I'm trying to use it as a normal array such as 'if a(2) = 1' etc, but I keep getting error.

Is it not possible to do this or am I gatting something else wrong.

JC

These are not the droids you are looking for.
LongFist
20
Years of Service
User Offline
Joined: 25th May 2004
Location: Winston-Salem, NC
Posted: 6th Oct 2004 13:16
Ummm, what type of error are you experiencing? And which version of DB are you using?

Check me if I'm wrong here: are you implimenting some sort of short-cut sorting algorithm?

Just a few observations to try and get it all straight (I'm going to see if I can make it happen here on my end...)

Cheers! I'll get back to you in a few minutes...

LongFist
SuperProgrammer For Hire
LongFist
20
Years of Service
User Offline
Joined: 25th May 2004
Location: Winston-Salem, NC
Posted: 6th Oct 2004 14:00
Hi Headless JC,

I checked your code, and found the most interesting problem: I could execute it flawlessly using F5/Execute, and it passed muster under F4/Check Syntax/Compile. But it killed the DBPro compiler (as in "send a message to Microsoft from XP because the application has encountered a hard error") when I tried to execute it in F6/Run In Debug Mode or F7/Step Through in Debug Mode (my favorite method, I might add!)

So I rolled back to the "good old days", when software coding was largely done "in the dark", relying on various printouts and/or save files to tell us what was going on under the hood.

Please forgive me, but I had to modify your code to prove that it was working properly...



...simply put, your code works fine. I checked it out immediately - and if you look at this new/improved debug output, you'll see where the code runs through the array, checking each for the corrct value, before moving on. Other than trashing the compiler in the interactive modes, your code works just fine.

However, for good and all, why don't you just access the array directly? From what I can tell, you really don't need those ARRAY functions to proceess array variables, any way. For clarity, let's look at the way I would have done it:



While it may not accomplish exactly what you were intending, it performs the same function as the previous code, but faster. Mind you, it's just a suggestion: the fun thing about programming is that there are millions of ways to accomplish a task - and none of them are wrong. (They all accomplish the same task! If the task is accomplished, then victory is established!)

Interstingly enough, my new code also crashes the debugger/single-stepper. Oh, well, it works in the runtime...

Hope this helps!!!

LongFist
SuperProgrammer For Hire
Jac
20
Years of Service
User Offline
Joined: 9th Nov 2003
Location:
Posted: 7th Oct 2004 04:23
Thanks LongFist.

I hadn't thought of doing it that way. The way I was doing it was bringing up a runtime error 118 array not available or in the wrong place (I paraphrase).

I was playing around with the code just after I posted last night and came up with a slightly different solution and as you say thats the fun part.

I'm using dark basic pro and if your interested this is what it was for (see code below) is a little simple program but learned loads from yourself and others.

Thanks again.

JC

These are not the droids you are looking for.

Login to post a reply

Server time is: 2024-09-23 02:26:47
Your offset time is: 2024-09-23 02:26:47