R
11

Realized my if-else logic was backwards after 3 hours of debugging at my desk

I was sitting at my kitchen table last Tuesday around 11 PM trying to get a simple login form to work. Kept getting an error every time I typed the right password. Turns out I had the condition flipped - I wrote 'if password does not match' instead of 'if password matches'. It rejected the correct password every single time. Took me 3 cups of coffee and a walk around the block to spot it. Has anyone else spent way too long on a mistake that was literally one word off?
2 comments

Log in to join the discussion

Log In
2 Comments
harper_smith
45 minutes I spent once on a Rails migration that kept failing because I wrote "add_columns" instead of "add_column". Plural vs singular, who would have thought Rails would be that picky about it. The weird thing is once you find it you feel both stupid and amazed that such a tiny thing caused so much trouble.
9
sarah_brown
Yeah I started double checking every single thing after that, @harper_smith, it's wild how one letter can wreck everything.
10