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 / How do you close a nest?

Author
Message
FPS Apollo
16
Years of Service
User Offline
Joined: 5th Apr 2010
Location:
Posted: 5th Apr 2010 19:28
I am making a 3d game with two levels. I used and if/then statement to do this but at the end it said that i couldn\'t close nest. Can someone tell me how to close it.
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 5th Apr 2010 19:59
Means you must have a missing ENDIF somewhere - I find it's best to indent code, so that anything inside an IF statement is tabbed. Then it's easier to spot missing ENDIFs because the code won't line up. I do the same with loops and functions.


Health, Ammo, and bacon and eggs!
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Apr 2010 20:21
Do as Van B says.

Just in case you don't know what "indent" means, here is an example:




You should always indent when the command has an "end" to it. Examples of these commands are:

-type
-select
-while
-repeat
-do
-for
-open to read
-open to write
-if

And of course the "end" of these commands are the following:

-endtype
-endselect
-endwhile
-until
-loop
-next
-close file
-endif

And, just because I'm bored, I put them all together:



Much easier to read than this:



TheComet

Login to post a reply

Server time is: 2026-07-26 15:31:27
Your offset time is: 2026-07-26 15:31:27