MQL wants extern instead of Input why?

 

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.

 
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. 

Understood Thanks alot.