You have a choice: If or Whether

If you’re a programmer, you know about “if.” We even call then “If statements.”

If some sort of code thing,
then some sort of code thing
else some other code thing.

We also have conditional sentences in English that have an analogous structure.

If you have short hair, it’s pretty hard to tie a ribbon in it.

But there’s another construction where the “if” is more or less in the middle of the sentence, and here it can get tricky, because you can put “whether” in the same spot where the “if” goes, but the meaning is significantly different. In this case, the “if” refers to what came before in the sentence, and “whether” refers to what follows.

The light tells you if the door is open. (Otherwise it doesn’t shine.)
The light tells you whether the door is open. (Maybe different colors of light for open and closed)

The message tells you if the car is ready. (Otherwise, it doesn’t tell you.)
The message tells you whether the car is ready. (The message says “car is ready,” or “car is not ready.”)

In other words, the “if” applies to what comes before, and it tells of the existence of what comes after.
But “whether” applies to what follows, and shows an alternative.  I should add that “Whether” always implies or says “or not.” If you can fit “or not” into the sentence, you should use “whether.”

Using “if” when you should use “whether” is easy, but don’t do it. Your meaning will be crisper, and nobody will get a mental hiccup from getting your meaning wrong at first.