My previous experience with while loops has shown that using them can be risky since you can drop into an infinite loop pretty easily.
As I research pathfinding among other things I see them in use quite frequently however, especially with ordered arrays/lists.
Altering the structure of an array while it is in the middle of a foreachloop has been problematic, but a while loop should allow more flexibility.