
上QQ阅读APP看书,第一时间看更新
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