Java - Does returning a value break a loop?

前端 未结 5 1591
时光说笑
时光说笑 2020-12-02 10:42

I\'m writing some code that basically follows the following format:

public static boolean isIncluded(E element) {
    Node c = head;
    while (c !=         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 11:19

    I should also add that if you want to break the current iteration of the loop, and instantly start the next one, you can use:

    continue;
    

    As it seems nobody has suggested it.

提交回复
热议问题