We use if to introduce a possible or unreal situation or condition.
Possible / Might happen
If my friend visits Singapore, I will take him to Gardens by the Bay. He might not come!
If I have time tonight, I will do my homework. I am very busy though. I might not have time!
Unreal / Imaginary
What if I could fly like a bird!
If I could fly, I wouldn’t need to take the MRT to work!
If I had been born in Singapore, I would have learned Chinese
When it rains, it pours!
We use when to refer to the time of a future situation or condition that we are certain of.
When my friend visits Singapore, I will take him to Gardens by the Bay. He is coming next week!
When I have time tonight I’ll do my homework. I finish work at 5pm so I’ll have time.