Whether - expressing a doubt or choice between alternatives
"I'm going whether you like it or not"
If- expressing a conditional statement. An event will occur when the condition after the word
"If the rain holds out, we can walk"
"If it takes me seven years, I shall do it"