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 / How to switch command lines.

Author
Message
grclaeys
13
Years of Service
User Offline
Joined: 14th Apr 2011
Location:
Posted: 15th Apr 2011 04:10
Hello, I am new to DarkBasic. I recently ran into a problem. I want to have my program return to a previous command line. This would save me a lot of time. I was wondering what the code was to do this (if possible) and how to do this. Thankyou.
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 15th Apr 2011 07:24
Wait, do you mean you want to pick up the command line from Windows?

Wyldhunt
15
Years of Service
User Offline
Joined: 27th Sep 2009
Location: The Dark Side
Posted: 15th Apr 2011 09:30 Edited at: 23rd Apr 2011 05:11
Let me see if I understand you correctly...

What you have is something like:



And, you are looking for a way to do something like:


Where the goto do stuff line will send the program back to the 'do stuff' line of code?
There are a number of ways to deal with that, but they all depend upon specific needs.
If it will keep cycling, a simple Do Loop will work.
If you have a specific block of code that you need to repeat in specific circumstances, you should create a function that you can call every time you need that code to run.

You can also use For and While loops to repeat specific blocks of code a certain number of times.

You can also use goto to execute a specific block of code, although a lot of pro coders frown upon goto because they tend to create spaghetti code.

I'm unaware of any command that would allow you to 'Go To Line 4' and continue from there.

If you can give more detail and perhaps a code snippet that would demonstrate your specific needs a bit better, we could probably give you more specific help. I don't think that the answer is going to be quite the way that you had envisioned, however.

Login to post a reply

Server time is: 2024-11-22 23:09:18
Your offset time is: 2024-11-22 23:09:18