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 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.162.49