GoTo Next Iteration in For Loop in java

后端 未结 6 1575
悲&欢浪女
悲&欢浪女 2020-12-22 23:24

Is there a token in java that skips the rest of the for loop? Something like VB\'s Continue in java.

6条回答
  •  温柔的废话
    2020-12-22 23:58

    continue;
    

    continue; key word would start the next iteration upon invocation

    For Example

    for(int i= 0 ; i < 5; i++){
     if(i==2){
      continue;
     }
    System.out.print(i);
    }
    

    This will print

    0134
    

    See

    • Document

提交回复
热议问题