if (One_Farm >= One_Farm_max) //continue; Two_Farm=Two_Farm+One_Farm*Perc_exit/100; One_Farm=One_Farm*(1-Perc_exit/100);
if (One_Farm >= One_Farm_max) //continue; { Two_Farm=Two_Farm+One_Farm*Perc_exit/100; One_Farm=One_Farm*(1-Perc_exit/100); }
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
Dear friends,
This is a sample regarding the usage of operator "continue" from https://book.mql4.com/operators/continue. I have a slight change in the coding resulting in different outputs. Could you enlighten me how the difference occur?
Problem 16. There are 1000 sheep on the first farm. The amount of sheep on the first farm increases by 1% daily. If the amount of sheep exceeds 50 000 at the end of month, then 10% of sheep will be transferred to the second farm. Within what time will the amount of sheep on the second farm reach 35 000? (We consider that there are 30 working days in a month.)
Here I just wanna change if (One_Farm < One_Farm_max) to if (One_Farm >= One_Farm_max). Below is my coding,
But the outputs are totally different. Maybe something wrong with the expression for If operator, so I have some modification as below (adding two braces).
Lucky, the outputs are the same as original ones but I am not quite clear about the caculation in the cycle. To be simple, what is the difference between below 2 expressions in the while cycle??