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.
    I’ll see you in August, when I come to New York,
    (I’m sure I’ll come to New York.)
    We can use both if and when to talk about things that always happen. There is not much difference of meaning.
    If/When you heat ice, it turns into water.