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 / could not close nest

Author
Message
steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 21st Dec 2006 14:04 Edited at: 21st Dec 2006 14:22
....sorry about this but i have read through this so many time its making my headache, i am sure i have closed all my if statements and i dont know what else it could be can somone pls give this a quick scan over. thanks

edit: language dbpro. woops also this is just the fps tutorial in dbpro, btw i just copied it out...and hopefully learnt.



no current projects starting db from scratch, so i can program stuff well, noob tutorials ime coming.

despite what it sais to the left joined 5 december 03
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 21st Dec 2006 14:33
Saying you just copied it out just ruined your chances of getting help. Go back and actually read the tutorial instead of pasting it's code, and you'll understand why you're getting a nested error.

Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 21st Dec 2006 15:43
Look through the code and match you IF's with your ENDIF's

Look in this bit of code:




The word "Gullible" cannot be found in any English Dictionary.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 21st Dec 2006 16:20 Edited at: 21st Dec 2006 16:20
another way to spot it very quickly is to use the tab button to indent your code.
use tab once to indent into an if statement, use another tab if nested and so on and so on

this mini example shows immediately what matches with what.



steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 22nd Dec 2006 19:01
yes i do see what you mean, and i said in my post that i think i have closed all my if statemments, and i thought i did indent most of it.

to be honset i dont see anything wrong with that code blade, its got 2 ifs and it has indeed got 2 endifs.

oh ruccus you got the wrong immpression, u lot dont half expect the worst of ppl.. by copied out the code, i meant i typed it out myself, hence copied out, sorry i thought it was quite clear and i read all the tutorial and infact the tutorial was wrong quite a lot it had mispelt commands and left bits out etc lol.

anyway back on topic, i will see if i can find out whats wrong whith that bit of code blade said.

no current projects starting db from scratch, so i can program stuff well, noob tutorials ime coming.

despite what it sais to the left joined 5 december 03
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 22nd Dec 2006 20:56
Quote: "to be honset i dont see anything wrong with that code blade, its got 2 ifs and it has indeed got 2 endifs."


remember an IF with a THEN doesn't need an ENDIF.


The word "Gullible" cannot be found in any English Dictionary.
steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 22nd Dec 2006 23:09 Edited at: 22nd Dec 2006 23:11
ah yes, thank you, cant beleive i missed that but still the error message comes up.

thanks for all of your help so far everyone.i will, keep reading through it.

oh also i changed the code above to this now.

i think it is correct, ime not sure if it has to be this way but all the same it looks better. thanks

no current projects starting db from scratch, so i can program stuff well, noob tutorials ime coming.

despite what it sais to the left joined 5 december 03
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Dec 2006 00:49
The snippet you posted is OK. So, just to clarify...

Exactly what error message are you getting? And what is on the line that is reported.

BTW: Before you run the program, change Sync On to Sync Off (if it's present). Doing this should make the error line reporting a lot more accurate.

TDK_Man

steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 23rd Dec 2006 17:19
The error message is could not close nest at line 254, the error comes up at whatver line is the bottom of my code even if changed.

oh and why does turning sync off change the accuracy of the error reporter?. thanks.

no current projects starting db from scratch, so i can program stuff well, noob tutorials ime coming.

despite what it sais to the left joined 5 december 03
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 23rd Dec 2006 17:51
Because the idea of Sync is to do all screen updates in one go - at which point the error occurs.

Mentioning that was just a general hint when trying to track down the actual line number of some errors - especially with DBC and less so with DBP.

So does the reported error line change with Sync Off?

And what is the actual line of code?

Oh yes - just remembered something - line concatenation!

Do you by any chance have any Rem lines which end with '...' (three full stops)? If so, try removing the full stops.

TDK_Man

steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 23rd Dec 2006 19:36
nope no full stops i had !! but i deleted them and it didnt help, the line of code is the very bottom line "data somthing" the code is in the very first post i did.

and no the line doesnt change whith sync off, ime pretty sure its always the bottom line. thanks

no current projects starting db from scratch, so i can program stuff well, noob tutorials ime coming.

despite what it sais to the left joined 5 december 03
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Dec 2006 02:46
Using any #Include files?

Errors in them usually result in the last line of the main code being highlighted in some IDE's.

TDK_Man

Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 24th Dec 2006 12:07 Edited at: 24th Dec 2006 12:09
Your indentation is very poor and you going to spend a lot of timd looking for nesting problems. Any nest if-endif do-loop for-next etc you must indent or when your code grows so will these problems. Even people like Indi and TDK, who have been programing for hundreds of years, still sometimes forget an ENDIF. But they can find it straight away because of good layout.

I've taken one of your sub-routines and added proper indentation, and you can see your codes is missing a NEXT and two ENDIF's.



Honest, get into the habbit of good indentation.


The word "Gullible" cannot be found in any English Dictionary.
steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 24th Dec 2006 16:13
okay i will, thank you, and yes that is mmuch easier to read. thansk for all your help.steve

no current projects starting db from scratch, so i can program stuff well, noob tutorials ime coming.

despite what it sais to the left joined 5 december 03
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Dec 2006 00:41
I know it's of no help to DBPro users, but I've added an option to my IDE for DBC which will load unindented code and automatically indent it.

I'm also working on another option which will scan your code and highlight all the Do's without Loops, For's without Next's and If's without Endifs.

TDK_Man

steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 26th Dec 2006 19:06
thats still great man, you are making life easier for people everywhere, cheers for the help

no current projects starting db from scratch, so i can program stuff well, noob tutorials ime coming.

despite what it sais to the left joined 5 december 03
Agent766
17
Years of Service
User Offline
Joined: 23rd Dec 2006
Location: Even I don\'t know.
Posted: 27th Dec 2006 00:46
I would say indent. Also, a bunch of my problems show up at the bottem even if it's at line 3. I'm new and j8ust naturally my first priority is indenting. I can usally track down errors thaks to the indents.

Quote: "I know it's of no help to DBPro users, but I've added an option to my IDE for DBC which will load unindented code and automatically indent it.

I'm also working on another option which will scan your code and highlight all the Do's without Loops, For's without Next's and If's without Endifs.

TDK_Man
"

Can you tell me how to do that? That would be very helpful for me. Also, would it work in DarkEDIT? If so, how can you get it to?

There are 3 kinds of people: Ones who can count, and ones who can't.

Did you know four out of five people have trouble with fractions?
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Dec 2006 14:53
Quote: "would it work in DarkEDIT?"


No - my IDE is a replacement for Dark Edit and there's a post on the Work In Progress board where you can download the latest working version.

The Auto-indent option is working but I've not finished the option for highlighting block and loop closing errors yet.

TDK_Man

Login to post a reply

Server time is: 2024-09-25 15:20:07
Your offset time is: 2024-09-25 15:20:07