"break" v "continue"
In many EAs I have inspected, the first "continue" is replaced with "break".
Which should be preferred? Thank you, Helmut
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 ?
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 ?
mentally replace 'continue' with 'skip' and 'break with 'stop/abort'. Life will be easier :)
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