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.

Newcomers DBPro Corner / What causes Closed Nest errors?

Author
Message
Aiyon
17
Years of Service
User Offline
Joined: 4th Jan 2007
Location:
Posted: 19th Jan 2007 22:29
My program is stalling on a close nest error, as you probably guessed.
The problem is that there are no incompletes in it. All gosubs have a return, all ifs have endifs, all mini-loops have the right variables and the do loop is present.
It stopped working when i added a DIM(18,18) data table and set about 100 of the parameters for it... is that the problem?
If not, what else could be causing a Closed Nest error?

Any help would be appreciated. ~Aiyon
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Jan 2007 23:30
'if' only needs an 'endif' when it doesn't have a 'then'.

Apart from that and with no code to look at, I can only suggest that you make sure that your code is correctly indented as that's a simple way to ensure you don't forget any of the matching command endpoints.

Aiyon
17
Years of Service
User Offline
Joined: 4th Jan 2007
Location:
Posted: 20th Jan 2007 00:33
Oops, sorry... yeah, all ifs have endifs when no then is involved.

I didn't post code because i'd have to post it all. But since i want this solved, here you go.

The last subroutine, the one with all the modifiers in it, is the one that seems to have broken things. But i don't know how.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Jan 2007 01:08
The first 'if' in your Shipbattle_Mode subroutine has neither a 'then' or a matching 'endif'. That's the only one I saw with a quick scan.

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Jan 2007 01:13 Edited at: 20th Jan 2007 01:18
[Edit] Oops - Ian posted while I was typing mine and beat me to it!

Like IanM says, your problem is lack of indentation. I pasted your code into my IDE and used the auto-indentation feature (sorry - shameless plug I know)!

Take a look:



You can see clearly that the problem is with a line in the Shipbattle_Mode procedure:

if ShipDataS=1; gosub ShipData_Setup

which should be:

if ShipDataS=1 Then gosub ShipData_Setup

With indented code, this literally took me around 10 seconds to find!

Your corrected and properly indented code:



TDK_Man

Aiyon
17
Years of Service
User Offline
Joined: 4th Jan 2007
Location:
Posted: 20th Jan 2007 01:24
Oops... that is a pretty silly mistake for me to make. I thought i'd checked all that.

Thanks for your help guys.

Login to post a reply

Server time is: 2024-11-26 23:21:37
Your offset time is: 2024-11-26 23:21:37