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

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 
主站蜘蛛池模板: 阳山县| 洮南市| 八宿县| 策勒县| 玉林市| 合水县| 栾川县| 阳山县| 陕西省| 横峰县| 金堂县| 南皮县| 镇雄县| 宁安市| 蒙城县| 泸水县| 南昌市| 和田市| 怀宁县| 连云港市| 麻城市| 恩平市| 临夏市| 北流市| 新营市| 石首市| 连云港市| 仙桃市| 台州市| 瓦房店市| 定西市| 凌海市| 阿城市| 介休市| 鲁甸县| 化德县| 祁阳县| 平谷区| 久治县| 白沙| 宜川县|