Can someone give an example of which cases is necessary create an infine for/while loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

12th May 2020, 10:40 PM
Omar Vasquez Hernandez
Omar Vasquez Hernandez - avatar
2 Answers
+ 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....
12th May 2020, 11:22 PM
𝗦𝗘𝗧𝗧𝗘𝗥
𝗦𝗘𝗧𝗧𝗘𝗥 - avatar
+ 2
Only in an embedded system but not here at all...
12th May 2020, 11:23 PM
BroFar
BroFar - avatar