Is there a function to replace Multiple "OR"  [SOLVED]

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Is there a function to replace Multiple "OR"

Postby arjfca » 02 May 2017

Hello

Is there a function that could replace multiple OR in this code

Code: Select all

ActualColor = TL_GetColor(TLNumber);

If (ActualColor = Magenta) or (ActualColor = Orange) or (ActualColor = Red) or (ActualColor = Fushia) then TlColor= Actualcolor ;
Martin

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Is there a function to replace Multiple "OR"

Postby TJ » 02 May 2017

Hello

Is there a function that could replace multiple OR in this code

Code: Select all

ActualColor = TL_GetColor(TLNumber);

If (ActualColor = Magenta) or (ActualColor = Orange) or (ActualColor = Red) or (ActualColor = Fushia) then TlColor= Actualcolor ;
Martin

What is wrong with OR ?

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Is there a function to replace Multiple "OR"

Postby arjfca » 02 May 2017

Hello TJ

Absolutely nothing wrong with the OR. Just to be fancy and reduce the coding line

Martin

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Is there a function to replace Multiple "OR"  [SOLVED]

Postby TJ » 02 May 2017

Hello TJ

Absolutely nothing wrong with the OR. Just to be fancy and reduce the coding line

Martin

The design philosophy of the EasyLanguage/PowerLanguage
is to have a programming language that is

easy to learn (English-like),
easy to program,
easy to read, and
easy to understand.

Would you make a suggestion on how to implement an "OR" that can fulfill the about criteria?

If you want to have more a sophisticated programming style, you should consider MultiCharts .net .


ps. you can always create a function to do a sophisticated "OR" operation.
eg.

IF ActualColor = _OR_( Magenta, Orange, Red, Fushia ) then TlColor= Actualcolor ;


Return to “MultiCharts”