Board Logo
« How to get out of an endless loop »

Welcome Guest. Please Login or Register.
Nov 20th, 2017, 10:19pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 sticky  Author  Topic: How to get out of an endless loop  (Read 5611 times)
Stefan Pendl
Administrator
ImageImageImageImageImage


member is offline

Avatar

Let's talk JB ...


Homepage PM

Gender: Male
Posts: 3711
xx How to get out of an endless loop
« Thread started on: Nov 17th, 2005, 2:08pm »

When testing a program it can happen that you end up in an endless loop.

To prevent you from loosing your unsaved code, press [Ctrl] + [Break].
This will force JB to stop working on the loop.

After pressing OK on the upcomming error message window, end the program with "Kill Basic Programs", located in the system menu under the window icon.

Now you can save your code and correct the endless loop grin

If the above does not help, then you will have to use [Ctrl] + [Alt] + [Del], but you will loose your unsaved work.

To avoid this in any case in the future, save your program every time before you hit the "Run" or "Debug" button grin
User IP Logged

Stefan - Homepage

Remember to read the forum rules board wink

Just BASIC 1.01, Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
ArchaicDragon
Member in Training
ImageImage


member is offline

Avatar

There are many stages of "Done" before anything is "Complete"


PM

Gender: Male
Posts: 49
xx Re: How to get out of an endless loop
« Reply #1 on: Aug 8th, 2007, 3:56pm »

Or another way is the handy BAK folder that they give you as long as it is still enabled in the pref. window. It automaticly saves the program for you as a .bak file, you just need to rename it to a .bas file and your set.
« Last Edit: Aug 8th, 2007, 3:57pm by ArchaicDragon » User IP Logged

Spawn
Guest
xx Re: How to get out of an endless loop
« Reply #2 on: Oct 5th, 2008, 8:03pm »

You could enter a scan statement into the loop checking for one or more conditions depending on what your program does and what it's functions are.. This would help as while the loop is running it can check whether a value in a string equals let's say 0 or 1 and if it equals 1 it will exit the loop using a goto command switching it to another branch.. smiley
User IP Logged

Shivamcoder3013
Full Member
ImageImageImageImage


member is offline

Avatar

Just BASIC, Liberty BASIC, HTML, CSS coder. Also partly/barely: PHP, JavaScript, Python/C++ coder.


PM

Gender: Male
Posts: 139
xx Re: How to get out of an endless loop
« Reply #3 on: Feb 5th, 2011, 7:39pm »

What is a "[break]" key?
User IP Logged

Just BASIC,Liberty BASIC,PHP, JavaScript, Python/C++ coder.
Using Windows ME
Stefan Pendl
Administrator
ImageImageImageImageImage


member is offline

Avatar

Let's talk JB ...


Homepage PM

Gender: Male
Posts: 3711
xx Re: How to get out of an endless loop
« Reply #4 on: Feb 5th, 2011, 7:45pm »

on Feb 5th, 2011, 7:39pm, Shivamcoder3013 wrote:
What is a "[break]" key?


The key called Pause/Break wink
User IP Logged

Stefan - Homepage

Remember to read the forum rules board wink

Just BASIC 1.01, Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
Shivamcoder3013
Full Member
ImageImageImageImage


member is offline

Avatar

Just BASIC, Liberty BASIC, HTML, CSS coder. Also partly/barely: PHP, JavaScript, Python/C++ coder.


PM

Gender: Male
Posts: 139
xx Re: How to get out of an endless loop
« Reply #5 on: Feb 5th, 2011, 7:54pm »

Oh. Barely looked at the top column of my keyboard. Thanks.
User IP Logged

Just BASIC,Liberty BASIC,PHP, JavaScript, Python/C++ coder.
Using Windows ME
Nik
Member in Training
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 45
xx moRe: How to get out of an endless loop
« Reply #6 on: Feb 24th, 2012, 09:12am »

Thank you.

That tip came in handy when a typo sent my star-sieve program into an endless back-spin...

( Faulty code reset the index of a FOR...NEXT loop ;- )

FWIW, there doesn't seem to be any way of reading a keyboard 'on the fly'. Sure, there's INKEY$ which, sadly, only works in a graphic window, plus NOTICE and its friends which could perhaps be used for 'okay, continue' controls. Neither approach seems suitable for building into huge MainWindow loops...
User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3129
xx Re: How to get out of an endless loop
« Reply #7 on: Feb 24th, 2012, 11:46am »

Well in reality the main win is for debugging and development. You should actually be building a GUI with buttons and controls all of which will suit one task or another. Building in main win is ok but it has some limitations.

I am sure if you share some code folks will show you GUI style examples of what you are trying to achieve.
User IP Logged

fay
Member in Training
ImageImage


member is offline

Avatar




PM

Gender: Female
Posts: 27
xx Re: How to get out of an endless loop
« Reply #8 on: May 31st, 2012, 01:05am »

Thank you. I didn't think it would ever stop. smiley
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls