What is the purpose of a never ending FOR loop? I can't think of any reason why I would use it - maybe as a virus to use up resources?
Never ending For
Started by
Guest_NeedHelp_*
, Aug 28 2006 04:56 PM
7 replies to this topic
#1
Guest_NeedHelp_*
Posted 28 August 2006 - 04:56 PM
Guest_NeedHelp_*
|
|
|
#2
Posted 29 August 2006 - 02:44 AM
Yeah as a virus perhaps? just to make the Pc crash or freeze?
#3
Guest_Jordan_*
Posted 29 August 2006 - 01:44 PM
Guest_Jordan_*
You could use it in a service that needs to always run a loop to check for something, given you didn't have a timer.
#4
Posted 31 August 2006 - 07:42 AM
Usually, you'd use a while loop for a never ending loop (like for a service). I can't think of any reasonable use for a never ending for loop. Since for loops check a condition and perform an increment (or, in C languages, perform another action) it'd be kind of wasteful to use it in place of a while (true).
#5
Guest_NeedHelp_*
Posted 31 August 2006 - 05:51 PM
Guest_NeedHelp_*
Hmm, so I guess there really is no use for it...
#6
Posted 01 September 2006 - 08:53 AM
No, there are reasons to use it listed above but they are not very practical.
#7
Posted 05 September 2006 - 08:14 AM
You could also use it in a command line project to always run the main menu loop. That is what we used in class anyway.
#8
Guest_Kaabi_*
Posted 05 September 2006 - 01:50 PM
Guest_Kaabi_*
The first thing that came to my mind was a virus. But those other uses are better.


Sign In
Create Account

Back to top










