[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Breaking out of a for(; ; ) loop



PureBytes Links

Trading Reference Links

Please confirm that the break keyword has no functionality in the new 
AFL for(;;) loops.  As an example the following code snippet did not 
produce a break out of the loop when executed yet AFL didn't complain 
about the presence of the key word break:

  for(i=1;i<BarCount; i++) {
     if (H[i] > H[i-1]){
       y[i] = H[i];
       if (y[i] >= 22.00)
          break;  // did not cause an exit out of the loop
     }
     else
       y[i] = L[i];
   }

As a work around I coded the loop as follows to simulate a break:

   for(i=1, j=BarCount; i<j; i++) {
     if (H[i] > H[i-1]){
       y[i] = H[i];
       if (y[i] >= 22.00)
          j=i;
     }
     else
       y[i] = L[i];
   }

I also have a question:  when an array variable is declared, can I 
assume all the array elements are initialized to zero?

Thanks ...

Mike O.





------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get a FREE REFINANCE QUOTE - click here!
http://us.click.yahoo.com/2CXtTB/ca0FAA/i5gGAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/