We use when for things that are certain to happen
in the future:
- I'll buy you a pair of gloves when I go shopping this
I'll give you a ring when I get home from school.
Note that although the reference is clearly to the future, we use
the present tense in the when-clause.
We use if for things that may happen and which we are not
- If I decide to come to London this year, I'll come
and visit you.
- I'm going to call the police if she's not back within
- If you make the salads, I'll prepare the barbecue.
In all of these examples, we are talking about future conditions
and whether we use when or if depends upon the certainty
of things happening.
However, when and if are interchangeable when
we are talking about general conditions that always apply when if
means almost the same as whenever. Compare the following:
- I keep the air-conditioning on at night if the temperature
goes above 30 degrees.
- I keep the air-conditioning on at night whenever / when
the temperature goes above 30 degrees.
- If the green flag is flying, it's quite safe to swim
You can swim here whenever / when / provided the green
flag is flying.