Variable , Primitive question

I am sorry but I have a primitive question. it’s about variable, I was trying to code my own EA and I was trying things out some of my custom function return with -1 others with zero but when took one of these functions that should return zero when there is no result and assign it to a variable that is initiated with -1 I noticed that the result change although according to my understanding that the new value of the function should be assigned to the variable instead of -1 but it seems that is not what happened and the result the function result change rather than if the variable is initialized by zero

anyone can explain to me why?

thank you

https://www.mql4.com/

ok I believe I am having hard time to figure out the answer from the Mql4 documentation,

the issue that I am facing is as if the custom function that I have in not being read in the EA because the variable that I have assigned this function to is initialized with -1 although when I change that variable to zero, it works fine,

Moreover when I test the function separately out of the EA and assign it to variable that is initialized with -1 , it works as expected and the new value of the function take place of the value of initialization (-1).

But still when I try out the function within the EA and just change the initialization value of the variable that the function is assigned to, to be zero it also works fine

the issue happens only when the initialization value of the variable is -1 and trying it within the EA

I was wondering if someone had the same issue and has explanation to it,

thanks