next 跳过当前循环

来源:互联网 发布:组装机 知乎 编辑:程序博客网 时间:2024/06/03 02:26
[oracle@PD sbin]$ cat t2.pl    for ($i=1;$i<=3;$i++){      $j=0;      print "\$i is $i\n";      while ($j<=7){      $j++;      if ("$j" == "5") { next;}      print "\$j is $j\n";      };     };      [oracle@PD sbin]$ perl t2.pl $i is 1$j is 1$j is 2$j is 3$j is 4$j is 6$j is 7$j is 8$i is 2$j is 1$j is 2$j is 3$j is 4$j is 6$j is 7$j is 8$i is 3$j is 1$j is 2$j is 3$j is 4$j is 6$j is 7$j is 8

0 0
原创粉丝点击