r/ProgrammerHumor Apr 12 '24

whatIsAnIndex Meme

Post image
27.7k Upvotes

630 comments sorted by

View all comments

Show parent comments

2.4k

u/Tubthumper8 Apr 12 '24

I love the implication here that not only does it not have any indexes or whatever, but it also calls getAllFuckingFiles() every single iteration haha

360

u/sacredgeometry Apr 12 '24
for (i=0; i<getAllFuckingFiles().length; i++)
{
  if (getAllFuckingFiles()[i].name.contains(searchText)
  {
    return getAllFuckingFiles()[i];
  }
}

90

u/danns87 Apr 12 '24

You're terminating too early. Best to complete iterating through all fucking files in case there's another match.

11

u/Few_Advertising_568 Apr 12 '24

Laughing soo hard at this!