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 / !@@#$%^& Nesting Error What The !@#$

Author
Message
Eddie Gordo
23
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 5th Jun 2003 21:32
whats a nesting error it says cannot close nest at what ever my last line is it makin me mad cause i cant test my MMORPG until it will compile
Artifact Basic-5%
Epic Crossings RPG-25%
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 5th Jun 2003 21:59


Pneumatic Dryll
Eddie Gordo
23
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 6th Jun 2003 07:17
that doesnt awnser my question whats closing a nest mean do i need an endif at the end or somthing

Artifact Basic-5%
Epic Crossings RPG-25%
Great Knight
23
Years of Service
User Offline
Joined: 25th Feb 2003
Location:
Posted: 6th Jun 2003 08:07
at the end of the funcsion make sure it ends. Read through your code make sure you dont have any thing missing out and spelling is corresct.

AMD Atherlon 2400+ XP, 380 DDr memeory, ATI Radeon 9000 64 DDR.

And a Katana.
ZomBfied
23
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 6th Jun 2003 10:25
If you have ifs that don't have endifs (and no thens) or if you have a next out of order or a for without a next.

ZomBfied
23
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 6th Jun 2003 10:26
SHow us your code... I could find it.

Martyn Pittuck
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 6th Jun 2003 11:06
for example

if
if
if



endif
endif

see one endif is missing. You are whats called nesting the if functions buy putting one inside another,.

The Outside is a evil place to be, too much light, too much noise and too many distractions....
I went outside once and my FPS rate dropped to 5.
LoKiDeCaT
23
Years of Service
User Offline
Joined: 28th Aug 2002
Location: United States
Posted: 6th Jun 2003 11:21
For must have a Next
If must have a Endif
Function must have an endfunction
Gosubs must have a Return
While must have Endwhile
Repeat must have an Until
Do usually has a Loop

A bit of proofreading can often overcome this problem.

Loki D'Cat - Modeller, Composer, Animator
Nerdsoft Creations
Machine Specs: Athlon XP1800+, ATi Radeon 8500 64mb, 1GB RAM, Windows 2000 AdvSvr
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 6th Jun 2003 16:28
Quote: "that doesnt awnser my question"

Um, yes it does. That's what a nesting error is Description and example included... Did I do something wrong in a former life ? Oh wait yes I did, it was the nFinity thread.

Pneumatic Dryll
Eddie Gordo
23
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 6th Jun 2003 17:18
it is hard to show you guys 1021 lines of code hmmm

Artifact Basic-5%
Epic Crossings RPG-25%
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 6th Jun 2003 18:09
The compiler should highlight the block of code where there is a nesting error. It normally highlights near the end of the block.

Whatever function the error is in, try going through it and tabulate, you will then spot the nesting error with ease.

Pneumatic Dryll
Eddie Gordo
23
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 6th Jun 2003 20:48
uh i dont have a function in my program

Artifact Basic-5%
Epic Crossings RPG-25%
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 6th Jun 2003 21:55
That doesn't affect nests, although functions are a nest, LoKiDeCaT has already listed other types of nest that you almost certainly do have.

I suggested tabulating the function but that really doesn't affect anything, tabulate that 'section' of code - however you group your code, or the whole program. It will help you find the nesting error.

Pneumatic Dryll
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jun 2003 17:39
I'd suggest coding in a more organised way from the start.

NOTE: Although I say 'should' a lot in the following lines, it's up to you These are the personal rules that I try to follow. By doing so, I almost never have nesting errors, and I can see the flow of the program by looking at indentation.


If you are coding an 'IF' for example, the very next line you should type should be 'ELSE' followed by 'ENDIF'. Then go back and fill in the code. Do the same with FOR/NEXT, DO/LOOP, WHILE/ENDWHILE.

When you insert the code, you should also add extra leading spaces, that indent you code further than the surrounding IF/FOR/whatever pair.

This is 'good':



This is 'bad':



The *only* time that I don't indent in this way is when I insert debug code - that's because by not indenting, it stands out, and I'm going to remove it later anyway.
Puzzler
23
Years of Service
User Offline
Joined: 18th Jan 2003
Location: United Kingdom
Posted: 7th Jun 2003 18:45
do u need to have endifs for single line ifs?

eg:



Piecing together the puzzle of Dark Basic- Puzzler

AMD Athlon 500 MHZ (393216K), NVidia TNT, Windows XP Professional Edition
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Jun 2003 19:03
Nope.
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 7th Jun 2003 19:05
No

Login to post a reply

Server time is: 2026-07-11 22:24:45
Your offset time is: 2026-07-11 22:24:45