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 / goto problem

Author
Message
Yamman
19
Years of Service
User Offline
Joined: 11th Jun 2005
Location:
Posted: 11th Mar 2006 22:21
in my second half of the program, wheel, it wont do any of the commands i tell it too. it does go to it however, because if i try and move for example an object that doesnt exsit, it tells me it doesnt exsit.

Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 12th Mar 2006 14:29
Right, this isn't the answer you're looking for, I'm afraid, but please, it will probably help you in the long run to stop using GOTO and instead look in to using functions.

Code with GOTO in it is notoriously difficult to understand and debug, because you're jumping around all over the place - it's known as spagetti code (because it's all jumbled up).

Here's some tips on how to make your code a bit sleeker:

Your highlight code

All that indenting of the 'if's helps figure out if you've missed an endif. Lifesaver that.

Functions instead of GOSUB/GOTO

Now, instead of "gosub flat" you can write "position_flat()" and when it gets to the end of that function, it will automatically return to where you left off.

The advantage of functions, is you could feed it numbers and it knows what to do with them...

With this, you would call it like so:

Anyway, hope that helps - I've got to go now.

Login to post a reply

Server time is: 2024-09-24 19:29:19
Your offset time is: 2024-09-24 19:29:19