While condition X is true, we remain within the while loop. So we are testing X again, and if true, continue into the while block. When X stops being true, we cease entering the while block and continue with the rest of the function.
for every value of some variable satisfying condition X
execute instructions Y
AnotherFunction(n)
p ← 1
for every integer i between 1 and n
p ← p·i
return p
This differs from an IF statement, in that if the statement is true, the block is entered, and then continue on with the function.
What if we need to initialise values?
p ← 1
i ← 1
while (condition X is met)
p ← p · i
i ← i + 1
We are evaluating, then reassinging values to the variables p and i. If we forget to update the values, the loop will be infinite.