EasyLanguage Reserved Words & Functions
This boolean operator is used in compare boolean values using OR logic.
Or
When used in a logical expression, OR returns True when the boolean values on either side of the OR are True, as in the table below:
Exp1 | Exp2 | Exp1 OR Exp2 |
---|---|---|
True | True | True |
False | True | True |
True | False | True |
False | False | False |
In order for an OR condition to be True, one or more of multiple conditions must be True.
If Plot1 Crosses Above Plot2 OR Plot2 > 5 Then...
Or is used here to determine if either the direction of the cross of the values Plot1 and Plot2, or that Plot2 is greater than 5 is True on the bar under consideration. If either is True, the condition returns True.
If Value1 Crosses Above Value2 OR Value1 > Value1[1] Then...
Or is used here to determine if either the direction of the cross of the variables Value1 and Value2, or that Value1 is greater that Value1 of one bar ago is True on the bar under consideration. If either is True, the condition returns True.
When used with integer values, the OR keyword functions as a bitwise operator, following the rules of the table below:
Bit1 | Bit2 | Bit1 OR Bit2 |
---|---|---|
1 | 1 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
0 | 0 | 0 |
Respective bits from each integer will be compared. If either bit is 1, then the resulting bit will be 1. If both bits are 0, the resulting bit will be 0.
For example, the integer expression 2 OR 4 = 6 (x0010 OR x0100 = x0110)
This is useful when there is a need to combine multiple enumerated values, such as in the following example where the font is created with both the italic and bold styles.
myFont = Font.Create(“Arial”, 10, FontStyle.Bold or FontStyle.Italic);
Combining enumerated values using OR is only available for enumerators with the [flag] attribute. Currently, only the FontStyle enumeration contains this flag.