5 ms·
I can't follow. The code I showed is already processing masterlist and decides if it should process masterlist[z].list2 for every z: 0..masterlist.length. I fu
by pmr_ 11y ago
I can't follow. The code I showed is already processing masterlist and decides if it should process masterlist[z].list2 for every z: 0..masterlist.length.
I fully agree that the code in my post is very bad, I took it from the article.
- zo1 11y agoThe main point is that you shouldn't rely on an implied rule that comes from the oddity of the length being 0 on a list. If I'm looping through a list, it's because I want to loop through it and process its items. I'm going to return/skip earlier due to whatever reason, and not rely on the "logic" for processing being built into the length of the list, or whoever populates the list.