The new for loops syntax was just added last year, which might explain while some sample code still uses the while loop.
Also the for loop as one big weakness: It only works with usize. So if you want to e.g loop over i32s you need to use a while loop.
In my head I divide between math and memory. Whenever I want to iterate over memory I use the for-syntax and whenever I use it to compute something or want to do something a number of times I use the while syntax.