For loop is used to verify each element at a time and it runs until the condition is reached. For loops condition is elements are returned at the beginning of the loop. So whenever we run a for loop, it goes through each element and gives out all the possible values.
While the loop is quite different from for Loop. While the loop runs the code until the condition is true. One the condition is true while loop stops to execute. At the same time, the parameters for while loop is not fully given at the beginning, The condition is given at the ending in a while loop.
This is the major difference between while loop and for loop. So whenever you work on real time projects then you will have more chance of understanding for and while loops. In many cases both can be used but only in some cases we need to choose specific loop. For loop is most used loop version in languages.