Teboho Rakotsoane :
For some weird reason if I declare variables on a global scope using input it throws an error that says constant cannot be modified but if I use extern instead of input it compiles.
Example
input int MA_Period=14;
//--That above code throws an error
extern int MA_Period=14;
//--This one compiles
but both of the mean the same thing.
That's right : ' input' variables cannot be changed. This is the law.
Vladimir Karputov:
That's right : ' input' variables cannot be changed. This is the law.
Like we cannot change the value of pi on math. thats sad, thank you.
You should almost never need to modify an input parameter. My personal rule is all input params get defined as input to prevent accidental mutation. If in the very rare instance that I ever need to programmatically modify that value then I will explicitly assign the value to a new local variable first, and then mutate it.
nicholish en:
You should almost never need to modify an input parameter. My personal rule is all input params get defined as input to prevent accidental mutation. If in the very rare instance that I ever need to programmatically modify that value then I will explicitly assign the value to a new local variable first, and then mutate it.
You should almost never need to modify an input parameter. My personal rule is all input params get defined as input to prevent accidental mutation. If in the very rare instance that I ever need to programmatically modify that value then I will explicitly assign the value to a new local variable first, and then mutate it.
Understood Thanks alot.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
For some weird reason if I declare variables on a global scope using input it throws an error that says constant cannot be modified but if I use extern instead of input it compiles.
Example
input int MA_Period=14;
//--That above code throws an error
extern int MA_Period=14;
//--This one compiles
but both of the mean the same thing.