3 ms·
I think I done this "hack" several times when I started coding and scratched my head for a while before realising I was missing an equality sign!
by kamjam 13y ago
I think I done this "hack" several times when I started coding and scratched my head for a while before realising I was missing an equality sign!
- kbart 13y agoHah, that's what make this "hack" so popular - it's very easy to miss, even for seasoned programmers, when just glancing at a code.
- derekp7 13y agoI remember this appearing on an exam in my C class back in '89 or so. It was basically "What does this code output...", and had "if (a = 3)" instead of "if (a == 3)". Thing is, I recognized the mistake, and though the instructor made a typo. So I answered based on what I thought the instruct had meant. Of course I got the question wrong. (I was fairly cocky back then, and normally I would have answered the question at face value just to "be that way", but I was trying to break that bad habit and it ended up back-firing on me anyway).