Giving name to a loop

前端 未结 6 1781
北荒
北荒 2020-12-06 05:33

While browsing questions and answers in this forum i found a piece of code were names were given to loops in order to use them for break. Like

nameofloop:
          


        
6条回答
  •  甜味超标
    2020-12-06 05:37

    I think it's the only case it's used. And it's not something which is commonly used, because it's usually more readable to change the value of a flag to end a loop prematurely.

提交回复
热议问题