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 / NEXT Variable

Author
Message
Random color object
16
Years of Service
User Offline
Joined: 14th Aug 2008
Location: Montreal Canada
Posted: 10th Sep 2008 02:32
Wny in the next using a variable? Code from Dark Physics help file.


When it is too complicated it is because you are trying at the wrong door.
tiresius
22
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 10th Sep 2008 05:55
That is what is known as a for..next loop.

I'm not a real programmer but I play one with DBPro!
RedFlames
17
Years of Service
User Offline
Joined: 25th Aug 2007
Location: Germania
Posted: 10th Sep 2008 10:11
Well after "next" you can write anything you want (atleast as a variable-name) or write nothing...
all these will work for me:



=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 10th Sep 2008 11:43
but its best to use



Because otherwise it gets complicated when using nested loops, e.g. When using 2d tiles



Also miss using for next commands causes the same kind of annoying errors as missing off an end if. Which the compiler doesn't make very easy to find.

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@
tiresius
22
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 10th Sep 2008 16:37
I'm with =Prof=. The variable after the NEXT might not be needed by the compiler... but sometimes it is needed by the programmer. In fact some people comment their END IF statements to describe which IF is being ended, in overly complex or long code. Indenting can be lost on a person if something is nested 5 or 6 deep.

BlueIDE auto-builds the "next <var>" line so I don't even have to think about it.

I'm not a real programmer but I play one with DBPro!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Sep 2008 18:30
Moved to Newcomers Corner

Random color object
16
Years of Service
User Offline
Joined: 14th Aug 2008
Location: Montreal Canada
Posted: 10th Sep 2008 18:45 Edited at: 10th Sep 2008 18:45
I guess it is for clarity: next next of what next of the variable.

When it is too complicated it is because you are trying at the wrong door.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 10th Sep 2008 19:14
To be honest, I've never really thought about it that much. Thats how it worked when I learned to program in ZX Spectrum Basic; and its just always been the way I've done it.

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@

Login to post a reply

Server time is: 2024-11-24 19:51:41
Your offset time is: 2024-11-24 19:51:41