官术网_书友最值得收藏!

The continue statement

What should you do when you want to skip one (or more) loop repetitions then, nevertheless, continue with the next loop iteration? For this, you need continue, as in this example:

for n in 1:10  
  if 3 <= n <= 6 
    continue # skip current iteration 
  end 
  println(n) 
end 

This prints out, 1 2 7 8 9 10, skipping the numbers three to six, using a chained comparison.

There is no repeat...until or do...while construct in Julia. A do...while loop can be simulated as follows:

while true 
# code 
  condition || break 
end 
主站蜘蛛池模板: 壤塘县| 卢湾区| 江达县| 东丰县| 霍城县| 镇巴县| 阿荣旗| 青海省| 宣汉县| 永新县| 广丰县| 阜新| 堆龙德庆县| 安西县| 栾川县| 滁州市| 巴南区| 涡阳县| 互助| 盐边县| 广丰县| 平利县| 阿鲁科尔沁旗| 青阳县| 潼南县| 麟游县| 昭通市| 赤峰市| 厦门市| 汝南县| 丘北县| 祥云县| 防城港市| 棋牌| 张北县| 安泽县| 锡林郭勒盟| 莲花县| 隆林| 教育| 隆子县|