The operators used to chain conditions in the following snippet appear to be equivalent when checking the values of “chain1” and “chain2” in the debugger and watch window:
|| operator is a boolean (logical) OR operator. It will give you only True (1) or False (0) result. You will get just 1 (True) if ANY of chained conditions is met.
+ operator is arithmetic addition. It will give you 0, 1, 2, 3, 4, 5 depending on how many chained conditions are met.
printf("%g", chain1 ); // this will print 0, 1, 2, 3, 4 or 5
printf("%g", chain2 ); // this will print 0 or 1
// the example below is incorrect
// Anything inside quotation marks IS NOT operator.
// "No|Yes" is just a text, nothing more
ParamToggle( "Text Highlight", "No|Yes", 1 ); // NOT AN OPERATOR!
… but when in general (apart from the cases similar to those above) these bitwise operators should be used in AFL?
And quite frankly, there is something I don’t quite understand (I didn’t think about it before). In the first example above, using “I” operator we tell AmiBroker to apply all the mentioned chart options (as if we used And), but in the second example we tell to choose “Yes” or “No”…
Moderator comment: second example was commented because it is incorrect
Your second example is incorrect. In the second example | is used INSIDE the string and it is NOT an operator. Everything inside double quotation marks is JUST A TEXT. ParamToggle uses | character as SEPARATOR between options. It could use comma or semicolon but then this would prohibit using commas or semicolons in option texts, so | is used as separator as nobody uses that in normal text.
Hint: sometimes LESS is more. If somebody asks for boolean (logical) operators it is better NOT to mention bitwise operators because it would just create additional confusion. Some things are better left untold unless somebody specifically asks.