There are four main types of if sentences in English, often called conditional sentences.If + present form + present form
These sentences are in two halves, with the if part in one half and the other part where you can use words such as can, will, may, might, could and would.
If + present form, + will, can or may
"If you heat ice, it melts."
In this type of sentence, you could use when instead of if. It's always true that when you heat ice it melts. This is why this type of sentence is sometimes called a zero conditional.
If + past form + would, could or might
"If I am late, I will call you."
"If you need me, you can call me at home."
"If it gets any hotter, we may have a thunder storm."
In these sentences (or first conditional sentences), there is a strong possibility that the first part (coming after if) is going to happen. The second part says what will happen as a result.
If + past perfect + would/might/could have done
"If I got a pay rise, I would buy a new car."
"If you left your job, you could travel around the world."
"If you were nicer to him, he might lend you the money."
In these sentences, the first part with if shows that the event is unlikely to happen. In English, we often use this type of sentence (called a second conditional) to talk about hypotheses, or imaginary future events.
For example, "If I was President of the United States, I would change some laws." But I know that I'll never be the President of the USA – I'm just saying what I would do if I was in his/her position. Note: in American English, it is correct to use "if I were…" In British English, it's more common to say "if I was…"
"If I had revised, I would have passed my exams."
"If we had gone out earlier, we might have got to the cinema on time."
"If you had told me there was a problem, I could have helped."
In these sentences (or third conditional sentences), the first part of the sentence with if didn't happen. So there is no possibility of the second part of the sentence happening. I didn't revise, so I didn't pass my exams and there is nothing I can do about it now. English speakers use this type of sentence to show how things could have been different.