2

Stop using 'i' in loops

Comments
  • 0
    @jasonpezzimenti your English hurts me xd
  • 5
    Welcome to devRant, green dot. I’ve got a tip for you before you get peeps here angry: learn to use the correct tags from the start.

    The devrant tag is for posts relating to the platform itself. This particular one should be tagged joke/meme, I gather.
  • 2
    @100110111 thanks for the advice
  • 0
  • 2
    i is short for index, so no!

    Because for(index = 0; index <= eyes; index++){}

    Is longer.

    Use foreach() or similar instead.
  • 2
    I don't. I just use o's. Two of them.
  • 2
    @C0D4 Blasphemy! i is short for iterator!
  • 1
    @TheCommoner282
    I was waiting for someone to say it.

    It's an iterator, and used as an index for arrays, which is about the only real time you would use a for() anymore anyway.
    For(i .....){
    data[i]
    }

    So, really it's declared as an iterator, and used as an index, but historically we blame Fortran.
  • 2
    OK, I'll use u instead
  • 0
    @TheCommoner282 when shall the stoning of this blasphemer commence?!

    *huffs in righteous indignation
  • 7
    j it is then
  • 1
    @asgs people use it in nested loops
  • 1
    Give me one good reason
  • 0
    @C0D4 In C++ it's perfectly normal to do
    for (Foo::Iterator i = foo.iterator(); i.next(); i.end()) {
    ...
    }

    I don't remember what the iterator API used to look like in cpp but that's how you'd use it.
  • 1
    my code, my rules
  • 2
  • 2
    I don't see the problem with variable name that is credit to math. It's a tradition.
  • 1
    Fine, fine, we’ll do it your way.

    For(let OwO = 0; WhatsThis(OwO); OwO++){
    // code
    }
  • 0
    @vedant-py k, l, and so on
  • 0
    @vintprox So is poorly written code. In some cases its institutionalized.
  • 0
    I got more comments than ++ on my rant
  • 0
    @vedant-py I wonder why
  • 1
    @Demolishun it is only imperative to use fully qualified variable name in iteration that is planned to be extended. Well, sorry for pointing out some middle ground here, can't help it.
  • 2
    @asgs I usually skip j and go right to k because j looks like i
  • 0
    @lbfalvy please use for_each if you're using real iterators...
Add Comment