if / whether

A condition versus an alternative.

Use if for a condition: If it rains, cancel the picnic. Use whether for alternatives, especially after verbs of asking and knowing: I asked whether the lock held. Whether is the word when or not is expressed or clearly implied. If in place of whether is common. Whether is the tighter word.

Examples

Use If the lock fails, call her.

Use I asked whether the lock failed.

Avoid I asked if the lock failed. (If you mean the alternative, not a condition.)