O
9
c/coding-for-beginnersjulia_leejulia_lee1mo agoProlific Poster

My little victory over a broken loop that drove me nuts

I was trying to make a simple number counter in Python, but it kept running forever and freezing my computer. Turns out I wrote 'while x > 0' but forgot to make 'x' get smaller inside the loop. After staring at it for way too long, I finally saw the missing line to subtract 1 from x each time. Has anyone else gotten stuck on a silly mistake like that for a whole afternoon?
3 comments

Log in to join the discussion

Log In
3 Comments
the_zara
the_zara1mo ago
Last year I spent three hours trying to figure out why my CSS animation wouldn't work. The whole thing was just a black box on the screen. I finally realized I'd spelled "background" as "backround" in the style sheet. My brain just refused to see it, even though I must have looked at that line twenty times. It's like your eyes glaze over after a while.
9
piperb93
piperb931mo ago
I read about a programmer who spent days on a bug caused by a single missing semicolon.
1
fisher.adam
Two thousand lines of code for a game once. Forgot to close an if statement bracket and the whole thing just crashed silently. Nothing popped up, no error, just a black screen.
1