Don't worry about, every programmer has run into this at some point. What you need to get used to is that computers are much more precise in what they consider correct, and that such differences can exist even if we don't see them (at first).
Sometimes I still study a line of text for several minutes where the git program says there is a difference but I don't see it. Usually I find it, but sometimes I get fed up, and use another program to point out the difference more precisely. In the latter case, there always is a difference of course, but sometimes hidden like in 2 spaces versus 1 space.
In this case, your problem is not being experienced enough to see “If” as incorrect because you haven't seen it often enough.
If you want to speed up that process, a good way is not to copy/paste code but instead use the keyboard to type it manually. It may seem counter-productive, but that makes a world of difference in memorizing the common patterns into your head. (Your brain will start finding similarities between lines and in time you will learn why these differences exist and what they mean.)
As a second tip, when you're stuck on a problem and you're out of ideas what to try next, stop working on it. Try again a few hours later or the next day, when you're more awake.