Computer Science Canada Exiting Loop After a Delay Help! |
Author: | heroes100 [ Thu Nov 05, 2009 6:54 pm ] | ||
Post subject: | Exiting Loop After a Delay Help! | ||
What is it you are trying to achieve? I am trying to get a loop to stop after a delay of w.e time. What is the problem you are having? I have a loop which generates random symbols and i would like it to stop generating these symbols after a designated time limit. Describe what you have tried to solve this problem I have tried to create a variable and make it add to the variable every loop and once it ='s a number it stopes but this will not work for i get a syntax error. :/ Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using 4.11 (or i can also load it with 4.0.5) |
Author: | BigBear [ Thu Nov 05, 2009 6:58 pm ] |
Post subject: | RE:Exiting Loop After a Delay Help! |
You have no exit condition I think you might want to use a for loop |
Author: | heroes100 [ Thu Nov 05, 2009 7:34 pm ] |
Post subject: | RE:Exiting Loop After a Delay Help! |
How can i make "let" a random int between 1-122 in a for loop? Also when it is a for loop how can i exit it with a delay?? :/ |
Author: | Kharybdis [ Thu Nov 05, 2009 8:01 pm ] | ||
Post subject: | Re: Exiting Loop After a Delay Help! | ||
|
Author: | heroes100 [ Thu Nov 05, 2009 8:25 pm ] |
Post subject: | RE:Exiting Loop After a Delay Help! |
Thanks for the responses. I have found a way around this. Even though the main question of how you can make a loop stop after a delay hasn't been answered but i have solved the problem. So all is well thx. ![]() |
Author: | Superskull85 [ Thu Nov 05, 2009 10:52 pm ] | ||||||||
Post subject: | Re: Exiting Loop After a Delay Help! | ||||||||
What do you mean by "stop after a delay?" Do you mean something like this:
Or do you mean like what Kharybdis posted:
Or do you means something like this:
I am a little confused about what you mean. Anyways, if you wanted to use a for loop with a random upper bound than you could do something like:
What did you do to solve the problem? |
Author: | heroes100 [ Fri Nov 06, 2009 8:22 am ] |
Post subject: | RE:Exiting Loop After a Delay Help! |
I meant more of the first but i do not know if that will still generate enough chars. as i need. I have ended up doing the 3rd thing you posted though but i was wanting it to generate random chars. and then stop after a set delay. But there is no need atm because i fixed it. |
Author: | B-Man 31 [ Fri Nov 06, 2009 11:33 am ] | ||
Post subject: | Re: Exiting Loop After a Delay Help! | ||
if your trying to do it after a set amount of time, you could do something like this, more or less:
|