+ 3
Can someone give an example of which cases is necessary create an infine for/while loop?
I want to know if there are any cases in which we actually need to create an infinite loop.
3 Antworten
+ 4
Infinite Loop is used to do your code never stop, Some programs need to stay running in background of machine.
When you are creating a server you need to make it stay running, so at the end of your code you will
need a infinite loop, if you don't use an infinite loop you will lose your connection or stop your program, because the code runs one time only.
Cases:
BackEnd programs to keep running, Game loop, keep server online, real time watching or waiting some command inside code, etc....
+ 2
Only in an embedded system but not here at all...