Gerard Willia G J B M Dinh Sy: I have a problem with the styler accessible in tools => Styler
It seems not to recognize else if
it transforms them into else, then if
Here is some test code
and once passed through the styler
This bothers me.... Can we do something to keep the else ifs?
THANKS
There is nothing wrong with that. In fact, it is showing you the correct levels of the code.
In this case, it would be much better to use a "switch" operator instead of the multiple "if".
Documentation on MQL5: Language Basics / Operators / Switch Operator
- www.mql5.com
Switch Operator - Operators - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
I think I found
In tools => options, styler tab choose "google" for example and the "else if" are kept.
Formatting on anything else isn't quite how I want it, but it will be fine
int value = 5; if (value == 1) { Print("Value is 1"); } else if (value == 2) { Print("Value is 2"); } else if (value == 3) { Print("Value is 3"); } else if (value == 4) { Print("Value is 4"); } else { Print("Value is not 1, 2, 3, or 4"); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Good morning
I have a problem with the styler accessible in tools => Styler
It seems not to recognize else if
it transforms them into else, then if
Here is some test code
and once passed through the styler
This bothers me.... Can we do something to keep the else ifs?
THANKS