var i = 0 while(i < 10) { i += 1 if(i % 2 == 0){ break //语句执行后,循环结束 } log('while 中的 continue 语句',i) } //运行结果 while 中的 continue 语句 1 var i = 0 while(i < 10) { i += 1 if(i % 2 == 0){ continue //打断后,跳过,接着执行循环 } log('while 中的 continue 语句',i) } /*运行结果 while 中的 continue 语句 1 while 中的 continue 语句 3 while 中的 continue 语句 5 while 中的 continue 语句 7 while 中的 continue 语句 9*/
break 和 continue
猜你喜欢
转载自www.cnblogs.com/hezhouhang/p/9144820.html
今日推荐
周排行