double diffTPSL (double a, double b) { diffTPSL = a + b; return(diffTPSL);}
I don't think that it is a good idea to have a variable named the same as a function, but if you do use it you must declare it.
double diffTPSL (double a, double b) { double diffTPSL = a + b; return(diffTPSL);}You should have seen the error report when you tried to compile it.
I don't think that it is a good idea to have a variable named the same as a function, but if you do use it you must declare it.
thank you, but indulge me as I am trying to understand how the system read the code
double diffTPSL
So this will not be considered as declaration because it does not end with semicolon or because it has been followed by the brackets that include the elements and the curly brackets that include the body or all the previous?
it could be very primitive question but I know that the First code is wrong and I want to know the correct reason for being wrong
it could be very primitive question but I know that the First code is wrong and I want to know the correct reason for being wrong
I already told you why.
I already told you why.
Thank you so much
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to understand the logic why it did not work on the first code, the below code is supposed to measure the number of pips between TP and SL
My question is why the name of the function and name of the double declaration in the body can not have the same name? specially that it make more sense for me , since diffTPSL has been declared as a double, and I diffTPSL to be the sum of a and b (TP , SL) and to return the value of diffTPSL , I dont understand why it did not compile
thanks for your help
* FIRST CODE
--------------------------------------------------------------------------
SECOND CODE: