14
Spent 45 minutes debugging a missing semicolon and realized I had been staring at the wrong line the whole time
I finally figured out that the error wasn't in the loop I kept checking, but in a function call two pages up that just needed a single character added, and now I'm wondering how many other beginners get stuck chasing the wrong problem because the error message points somewhere confusing.
2 comments
Log in to join the discussion
Log In2 Comments
michael_coleman109d agoMost Upvoted
Take that idea and run with it because compilers are basically trolling us on purpose. The error message points you at line 50 where the code broke, but the real issue is on line 12 where you forgot a closing bracket or a semicolon. It's like getting a flat tire and the car tells you the problem is 10 miles down the road where you crashed. Beginners need to learn that error messages are just rough hints, not the exact truth. The real skill is learning to backtrack from the crash point and look at every function call that leads into it. You basically have to think like a detective working backwards from a crime scene, not like a mechanic fixing exactly what the warning light says.
3
terryw6712d ago
Hold up. Two whole pages away from where the error was flagged? That feels like a rookie trap the compiler sets on purpose just to mess with us. I'd probably still be refreshing that loop for another hour if I didn't read this.
2