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

[amibroker] Re: to stop the run of the code



PureBytes Links

Trading Reference Links

thank you Mike to clarify.

I was stuck in web documentation and I have forgotten the help menu... :)

regards

reinsley


--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Hi,
> 
> break and continue are related but different commands. Break applies 
> to all remaining iterations, continue applies to the current 
> iteration.
> 
> Break will terminate the loop completely (i.e. stop executing the 
> rest of the loop body, and move on to the statement immediately 
> following the loop body, even if all values of the looping variable 
> have not yet been iterated over).
> 
> Continue will terminate the current iteration (i.e. stop executing 
> the rest of the loop body, but still restart from the beginning of 
> the loop body at the next iteration of the looping variable).
> 
> In both cases, you would normally have conditional code to control 
> what you want to do.
> 
> For example; in the code below, a trace will be printed when i == 1to 
> 8 except when i == 5 (continue without trace), and never reach i == 9 
> to 10 since break will force an exit.
> 
> for (i = 1; i <= 10; i++) {
>   if (i == 5) {
>     continue;
>   }
>   _TRACE("i == " + i);
>   if (i == 8) {
>     break;
>   }
> }
> 
> For more information, run AmiBroker, click Help menu, click on Index 
> tab and type in break. Do the same for continue.
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "reinsley" <reinsley@> wrote:
> >
> > 
> > Thank you Ed for your help.
> > 
> > I did not find the help documentation concerning break, not easy as
> > the word break appears often in the domain of technical analysis.
> > 
> > Anyway, my poor programming knowlegde comes from VBA, so step by 
> step
> > and stop are missing me. Probably it's useless with more practice
> > 
> > without break, I get that :
> > [1632] n1= 0
> > [1632] n1= 1
> > [1632] n1= 2
> > [1632] n1= 3
> > [1632] n1= 4
> > [1632] n2= 5
> > [1632] n2= 6
> > [1632] n2= 7
> > [1632] n2= 8
> > [1632] n2= 9
> > 
> > with a break, this :
> > [1632] n1= 0
> > [1632] n2= 5
> > [1632] n2= 6
> > [1632] n2= 7
> > [1632] n2= 8
> > [1632] n2= 9
> > 
> > I wish :
> > [1632] n1= 0
> > 
> > for( n = 0; n < 5; n++ )
> > {
> >     SinePlotter( n/2+Cum(0.01), n );
> > _TRACE("n1= " + n);
> > break;
> > }
> > 
> > for( n = 5; n < 10; n++ )
> > {
> >   SinePlotter( n/2+Cum(0.01), n );
> > _TRACE("n2= "+ n);
> > }
> > 
> > What I would like is a real stop even out of a loop. Does it exist 
> in
> > the Ami world ?
> > 
> > Your answer to KBH about sub is helpful.
> > 
> > Regards
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Ed Hoopes" <reefbreak_sd@> wrote:
> > >
> > > To stop code caught in an infinite loop try Shift+Break on the 
> keyboard 
> > > 
> > > To stop  execution in the code stream use Break; It is covered in 
> the
> > > Help file. 
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "reinsley" <reinsley@> wrote:
> > > >
> > > > I'am looking for a way to stop the code running.
> > > > I saw break/continue statement for loop, unfortunately the 
> links are
> > > > broken.
> > > > 
> > > > http://www.amibroker.com/guide/v50/keyword/break.html
> > > > http://www.amibroker.com/guide/v50/keyword/continue.html
> > > > 
> > > > Does it exist the equivalent statement to stop the code at a 
> specific
> > > > point ?
> > > > If not, any trick to do it ?
> > > > 
> > > > Thanks
> > > >
> > >
> >
>



------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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