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

[amibroker] Re: Switch.... Case.... question...



PureBytes Links

Trading Reference Links



Aaaargh! Sorry, forgot Google Chrome doesn't play nice with Yahoo's Rich Text Editor :(

Logic starts executing at the matching case and continues until a break statement or the end of the switch body. So, if you want the same logic to apply to multiple cases, then just stack the individual case statements together as follows:

switch ( x ) {
   
case 9
:
      ...
      
break


   
case 10
:
   
case 11
:
      ...
      
break
;

   
case 12
:
      ...
      
break

}

Similarly, if you want the same logic to apply to multiple cases, but you also want some additional logic for one of those cases, you can start processing the one case, then let it "fall through" to the next case group by NOT using a break statement.

e.g.

switch ( x ) {
   
case 9
:
      ...
      
break


   
case 10
:
      ...
      
// No break! Fall through to next case


   
case 11
:
      ...
      
break
;

   
case 12
:
      ...
      
break

}

Mike

 

--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70" sidhartha70@ wrote:
> >
> > Can I use logical operators within the Case statement...??
> >
> > i.e.
> >
> > Switch (x)
> > {
> > Case 9:
> > ...
> > Case 10 OR 11:
> > ....
> > Case 12:
> > ....
> > }
> >
>



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___