All grammarB1
als or wenn
The rule
In the past, als is for one single time or period and wenn for something that happened again and again, and after both the verb goes to the end of the clause.
als is for one time or one period in the past: one age, one event, one time in your life: Als ich sieben war, kam ich in die Schule.
wenn is for something that happened again and again, often with immer or jedes Mal: Immer wenn ich krank war, blieb ich zu Hause.
In the present and the future wenn is for one time too: Wenn ich morgen Zeit habe, rufe ich dich an. wann is only a question word, also in an indirect question.
Examples
Als ich sieben war, kam ich in die Schule.
When I was seven, I started school.
Immer wenn ich krank war, blieb ich zu Hause.
Whenever I was ill, I stayed at home.
Jedes Mal, wenn ich Fragen hatte, half mir meine Lehrerin.
Every time I had questions, my teacher helped me.