just a small question about coding style:
basically I want to delete all objects with a specific prefix.
All works fine but I saw someone using a slightly different approach and wanted to know what is the preferred way to do it:
This is what I did till now:
Now I saw something similar to this:
Is the second option to be preferred ( e.g. faster ect..) over my present one.
Just want to learn from the more experienced once if anyone is so kind to share their knowledge.
basically I want to delete all objects with a specific prefix.
All works fine but I saw someone using a slightly different approach and wanted to know what is the preferred way to do it:
This is what I did till now:
Inserted Code
for(_i = ObjectsTotal() - 1; _i >= 0; _i--) {
_FullObjName = ObjectName(_i);
if(StringFind(_FullObjName, sFullUniquePrefix) > -1) {
ObjectDelete(_FullObjName);
}
} Inserted Code
int _i = 0;
while (_i < ObjectsTotal()) {
_FullObjName = ObjectName(_i);
if (StringSubstr(_FullObjName, 0, StringLen(sFullUniquePrefix)) == sFullUniquePrefix) {
ObjectDelete(_FullObjName);
}
else {
_i++;
}
} Just want to learn from the more experienced once if anyone is so kind to share their knowledge.
__Thanks__ MJ