Compare when and if:
We use if to say that we are not sure whether something will happen
I’ll see you in August, if I come to New York
(perhaps I’ll come to New York; perhaps I won’t)
We use when to say that we are sure that something will happen
We use you in August, when I come to New York.
(I’m sure I’ll come to New York)
I’m going shopping later, (for sure) When I go shopping, I’ll buy some food.
I might go shopping later, (it’s possible) If I go shopping, I’ll buy some food.
If it is raining this evening, I won’t go out. (not When it is raining)
Don’t worry if I’m late tonight, (not when I’m late)
If they don’t come soon, I’m not going to wait, (not When they don’t come)
We can use both if and when to talk about things that always happen.
There is not much different of meaning
If/When you heat ice, it turns into water