Subordinate clauses: wenn

Wenn es kalt ist, ziehe ich eine Jacke an.

The conjunction wenn can introduce a conditional clause. A conditional clause is a subordinate clause that expresses a condition. The condition is expressed in the subordinate clause, while the consequence is expressed in the main clause:

Wenn ich krank bin, … – condition in the subordinate clause

… (dann) bleibe ich im Bett. –  consequence in the main clause

The word dann in the second half of the sentence can also be left out.
 

You can also start with the main clause:

Ich bleibe im Bett, wenn ich krank bin.

In this case, dann is left out.

Here are some more examples:

Wenn es regnet, nehme ich einen Regenschirm mit.

Ich nehme einen Regenschirm mit, wenn es regnet.

Wenn ich gute Laune habe, singe ich ein Lied.

Ich singe ein Lied, wenn ich gute Laune habe.

Note:
The verb in the main (declarative) clause is always in second position. First position can be occupied by one word, several words or a subordinate clause:

Ich mache einen Ausflug.

Morgen mache ich einen Ausflug.

Nächste Woche mache ich einen Ausflug.

Wenn ich frei habe, mache ich einen Ausflug.