Why use infinite loops?

前端 未结 14 2000
轮回少年
轮回少年 2021-02-08 13:33

Another poster asked about preferred syntax for infinite loops.

A follow-up question: Why do you use infinite loops in your code? I typically see a construct like

14条回答
  •  旧巷少年郎
    2021-02-08 14:00

    Webservers use an infinite while loop:

    while(true)
    {
        //Do something like respond to requests
    }
    

    They don't have to end unless you close your webserver application.

提交回复
热议问题