ernest02:
Of course. In the first case the block under {} is always executed. In the second case not.
Would there be any difference in the result between the following two pieces of code?
First one:
and
ernest02:
The green highlighted code will execute only if the IF statement (in blue) is true, and the red highlighted code will execute regardless whether the IF statement (in blue) is true. In other words, the red highlighted code is not logically connected to the conditional IF statement highlighted in blue and therefore will always be executed.
Would there be any difference in the result between the following two pieces of code?
First one:
if (FirstCurr == "GBP" && SecondCurr == "AUD") Pair = "GBPAUD"; { if ((GBPbefore > AUDbefore) && (GBPafter < AUDafter)) SellArray[3] = true; if ((GBPbefore < AUDbefore) && (GBPafter > AUDafter)) BuyArray[3] = true; }
and
if (FirstCurr == "GBP" && SecondCurr == "AUD") { Pair = "GBPAUD"; if ((GBPbefore > AUDbefore) && (GBPafter < AUDafter)) SellArray[3] = true; if ((GBPbefore < AUDbefore) && (GBPafter > AUDafter)) BuyArray[3] = true; }
Thanks guys! This helped me a lot and saved me many hours of finding the mistake!
Ernest.

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
Would there be any difference in the result between the following two pieces of code?
First one:
and