Generally speaking, a for loop is used when you know how many iterations you need.
Otherwise a while loop is used and is terminated when a condition is met.
That's not to say that there isn't instances where you could use either. And both can be broken out of prior to the condition that would naturally end them.