19

just realized puting else continue in my while loop was redundant. lol

Comments
  • 3
    At a previous company, I refactored a couple thousand for loops because their first dev would do something similar to:

    for ($i=0; $i<count($array); $i++) {
    //do something

    if ($i == (count($array) - 1)) {
    break;
    }

    $i++;
    }

    I couldn't believe my eyes when I found that in every.. single.. for loop.
  • 0
    @purged Similarly, after a long leave, someone had started a new code base with no for loop, but a hell lot of :

    int i = 0;
    while (i < CONSTANT)
    {
    //...
    i++;
    }
    // no, not even using i after that.

    I had to rewrite them. I mean, who would brace that way? >;D
  • 0
    (in reality, I am bracing style agnostic)
Add Comment