Use for instead of while

Proper `for` usage saves some bytes.