--Originally published at angelmendozas
Depends on the program you are writing, the if loop does or stops the desired task until what you programmed tells the program to do so.
While loop does a task as long as something happens to do that task, after that it stops.
A for loop can be combined with while but for a desired value the program does something.