Difference between these two sintaxis?

To add comments, please log in or register
Fernando Jose Velasco Borea
706
Fernando Jose Velasco Borea  

Hello all, I'm learning MQL4 and I'd like to know the difference between these three ways of coding:

//The idea is to combine a written message with a value

int A = 5;
int B = 10;

int C = A + B;

//Which one would be the best option?

Alert("5 + 10 is equal to " + C); //Option 1


Alert("5 + 10 is equal to ", C); //Option 2


Alert("5 + 10 is equal to " IntegerToString(C)); //Option 3

And, the SomethingToString is available to be used with wich operators? (DoubleToString, IntegerToString,...)


Best Regards,

Fernando.

Eugenio Bravetti
5033
Eugenio Bravetti  
FernandoBorea:

Hello all, I'm learning MQL4 and I'd like to know the difference between these three ways of coding:

And, the SomethingToString is available to be used with wich operators? (DoubleToString, IntegerToString,...)


Best Regards,

Fernando.

Option 3 is wrong code....

correct code is

Alert("5 + 10 is equal to ", IntegerToString(C)); //Option 3

else, all coding return same result

Fernando Jose Velasco Borea
706
Fernando Jose Velasco Borea  
Eugenio Bravetti:

Option 3 is wrong code....

correct code is

else, all coding return same result

Thanks:) 

whroeder1
17942
whroeder1  
FernandoBorea:  I'm learning MQL4
Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
          General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon.
nicholi shen
1898
nicholi shen  
whroeder1:
Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
          General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon.

Chill out Willy

Anthony Garot
1864
Anthony Garot  
FernandoBorea:

Hello all, I'm learning MQL4 and I'd like to know the difference between these three ways of coding:

And, the SomethingToString is available to be used with wich operators? (DoubleToString, IntegerToString,...)


Best Regards,

Fernando.

Personally, I use StringFormat() for this sort of thing.

https://www.mql5.com/en/docs/convert/stringformat

Alert(StringFormat("5 + 10 is equal to %d", C);
To add comments, please log in or register