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
Array[x] = array[x+1] will work if the struct does not have any strings or dynamic arrays.
Thank you for the info WHRoeder
I need the if because if the element to be removed is the final element, it's just a matter of resizing the array to remove it. If I didn't do that, the loop would give an array out of range error for [x+1]
Unfortunately I have been simply unable to get my head around classes, so have to stick to basic mql4.
Thank you for the info WHRoeder
I need the if because if the element to be removed is the final element, it's just a matter of resizing the array to remove it. If I didn't do that, the loop would give an array out of range error for [x+1]
Unfortunately I have been simply unable to get my head around classes, so have to stick to basic mql4.
Yes, you are correct, I confuse myself sometimes.
I should have said that when x==as-1, it has to be dealt with individually as [x+1] doesn't exist
The for loop moves elements down. The end condition is such that is doesn't move beyond the last element. If it did, the for loop is wrong and the code breaks.
The for loop moves elements down. The end condition is such that is doesn't move beyond the last element. If it did, the for loop is wrong and the code breaks.
The last element cannot be removed by the loop. How else can I remove it if it is not dealt with individually?
The loop moves elements down. Period.
The resize removes that last element. What more is necessary?
Ah, I get you now.
Sorry, sometimes my brain dies :)