DEV Community
•
2026-04-18 09:12
The Loop That Ate My Computer
Let me tell you what happened the first time I wrote a loop.
I wanted to print numbers from 1 to 10. Simple enough. I had just read about while loops. I thought I understood them. So I wrote this:
number = 1
while number < 10:
print(number)
I ran it.
Numbers started printing. 1, 2, 3... wait. Same numbers? 1, 1, 1, 1, 1, 1, 1, 1...
The terminal filled up. Lines kept coming. The...