while — Expert Playground
Starts a loop that repeats as long as its condition is true
Python Playground
Output
Click "Run" to execute your codeCPython optimizes 'while True' into an unconditional jump — there is no condition check at all. 'while variable' adds a load and test on every iteration.
Challenge
Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?