Say when something happens
Use とき after a verb or adjective to say "when" something happens.
when ~, [main action]
とき attaches to the plain form of a verb or adjective and marks the time at which an action or state occurs. The clause before とき describes the situation, and the main clause says what happens then. The tense of the verb before とき controls whether the action happens before or after the main event.
Tips and Common Traps
とき is great for setting a scene — use it to say when you do something or what you do in a certain situation, like 疲れたとき、音楽を聴きます (when I'm tired, I listen to music).
The tense before とき changes the timing: 家を出るとき、電気を消した (I turned the light off as I was leaving home) vs 家を出たとき、雨が降っていた (when I had left home, it was raining). Same tense in the main clause — different moment.