Hacker News new | ask | show | jobs
by 10000truths 1398 days ago
I would rather just use a plain for loop and manipulate the index in the loop body:

  for(uint32_t i = 0; i < length; ++i) {
      i = (length - 1) - i;
      // ...
  }
Much easier for me to understand, making it less likely to mess anything up.
2 comments

You'll need a new variable there, but otherwise yeah.
Even easier (for D):

    foreach (i; 0 .. length)
D takes care of selecting the correct type for `i`.