I was working on some iOS programming today and was hitting my head against what was seemingly an immovable problem.
I could not get one of my statements to resolves to true. No matter what I would do, it would always resolve to false and mess everything up.
I stared at the problem for probably a half-hour before it finally hit me.
Arrays are zero-indexed.
Yup, of course it to going to resolve to false when it will NEVER be equal. Never. Ever. Period. No amount of hoping will change it. In programming, n will never be equal to n + 1. it just won’t happen.
So … sometimes you need to take a step back and just think things through a little bit. Even the most basic of computing tenets sometimes escape your brain and need to be unearthed again.