Giving name to a loop

前端 未结 6 1780
北荒
北荒 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 06:01

    You can also say:

    continue nameofloop;
    

    ...to jump to start of the named loop. I don't think there are any other use cases for labels in Java.

提交回复
热议问题