when to use while loop vs for loop