A loop does not stop executing immediately when its condition evaluates to true. A loop’s condition is evaluated at the start of a loop, meaning when the loop starts for the first time or the execution of a previous iteration of the loop body has just finished.
Even though number equals 2 at one point, the loop runs forever.
The condition of a loop is evaluated when the execution of a loop starts and when the execution of the loop body has reached the closing curly bracket. If the condition evaluates to true, execution continues from the top of the loop body. If the condition evaluates to false, execution continues from the first statement following the loop.
The loop above never stops executing.