2 ms·
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;
by 10000truths 4y 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.
- edflsafoiewq 4y agoYou'll need a new variable there, but otherwise yeah.
- WalterBright 4y agoEven easier (for D): foreach (i; 0 .. length) D takes care of selecting the correct type for `i`.