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 Discussion / How do you structure your code?

Author
Message
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 7th Mar 2003 17:49
Just wondering, I find that the easiest way is to make a program is to have a main loop (usually a do-loop) and have gosub commands within that. Then I write the code in chunks separated into different sub-routines. Usually I dont have any code in the main loop apart from sync and the gosubs. Like this...



I find that that way I can re-arrange the code easily to correct an error and it is also easiest to see how my code is working.
Yum! Yum! Yum! Yum!
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 7th Mar 2003 19:30
That's probably a better way than I do it. I just stuff code into the main loop, in a random order unless order is required.

Once I was but the learner,
now, I am the Master.
Attreid
22
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 7th Mar 2003 19:40
Yeah, I do it too
and it's very good 'cause you can use the same code in several loops, or in loops which are in the main loop

I'm following John, but I'm not john.
Lol, it is funnier in french
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 7th Mar 2003 22:44
yeah, same here, i use the multiple gosubs within loop method, find it to be very easy to understand your code after not seeing it for years ^_^

everyday of life is a new chapter that has already been fortold but is up to the soul to capture.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 8th Mar 2003 03:15
setup

pre main

main

gosubs

function

Login to post a reply

Server time is: 2025-08-08 20:40:08
Your offset time is: 2025-08-08 20:40:08