Skip to main content

All Questions

Tagged with
2 votes
2 answers
186 views

Should special case be inside or outside the for loop here?

For example, suppose I have 2 arrays: let arr1=[5,2,1]; let arr2=["abcde","ab","a"]; my work is simple : to check if length of strings in arr2 are larger than corresponding element with same index in ...
ocomfd's user avatar
  • 5,750
3 votes
2 answers
126 views

Should I move tasks which is just for a specific element only out of for loop?

For example, I have a for loop, which element 0 has additional function to run compared with other elements, my question is, should the additional function be: 1.place inside for loop for(int i=0;i&...
ocomfd's user avatar
  • 5,750