19
I was at the library and saw a kid get stuck in a coding loop
I was picking up a book at the local branch yesterday and walked past the computer area. A kid, maybe 12, was staring at his screen, typing the same three lines over and over. He was trying to make a simple game character move, but he kept writing 'move right' without any condition to stop. It was a perfect, real-world example of an infinite loop. I showed him how to add a limit, like 'for 5 steps', and his face just lit up. Has anyone else had a moment where a basic coding concept just clicked from seeing it happen in person?
3 comments
Log in to join the discussion
Log In3 Comments
kelly_craig4d ago
Wait, isn't that just a loop without a break? The real infinite loop would be if the character kept moving forever.
1
the_wren4d ago
But does it even matter?
7
carter.laura4d ago
My last project had that exact bug in the render loop.
2