"break" v "continue"

 
In MQL4 Documentation is this code snippet to illustrate the use of Symbol()...

   int total=OrdersTotal();
   for(int pos=0;pos<total;pos++)
     {
      // check selection result because the order may be closed or deleted at this time!
      if(OrderSelect(pos, SELECT_BY_POS)==false) continue;
      if(OrderType()>OP_SELL || OrderSymbol()!=Symbol()) continue;
      // performs some processing...
     }


In many EAs I have inspected, the first "continue" is replaced with "break".

Which should be preferred? Thank you, Helmut

 
engcomp:

In many EAs I have inspected, the first "continue" is replaced with "break".

Which should be preferred? Thank you, Helmut

It depends on the overall EA design; it's hard to generalize. What's important is that you understand the difference. If u do, then you'll be able to decide how well it fits your own EA.
 

Do I understand it correctly ? continue will jump out of the current cycle of the for loop and start the next one, and break will exit the for loop entirely ?

 
SDC:

Do I understand it correctly ? continue will jump out of the current cycle of the for loop and start the next one, and break will exit the for loop entirely ?

Yes, but 'continue' will only start the next loop iteration if the loop condition still evaluates true.
 
mentally replace 'continue' with 'skip' and 'break with 'stop/abort'. Life will be easier :)
 
cameofx:
mentally replace 'continue' with 'skip' and 'break with 'stop/abort'. Life will be easier :)
I think in BASIC there was "next" for continue and "exit" for break. Thank you for the comments.