If means " in case" something happens , something else will be possible or it is a condition for something to happen . For example :
If it rains, i can't come .
If he learns well , he will pass the exam.
So only in case he learns ,it is possible to pass the exam ,
Whether means " in both cases" , or " anyways" something will happen ,, no matter .
For example .
i will go , whether it rains or not ... ( in both cases , anyways , i will go ,, no matter how the weather is ).
He will pass the exam, whether he studied or played . ( He will succeed in both cases , studying or playing .
I hope now you understood the basic difference between the two :)