Japanese has four conditionals where English has one 'if', and they are not interchangeable: と for automatic results, たら for a specific case, ば for a general one, なら for picking up what was just said. This page puts them side by side.
Also known astara nara ba toたら なら ば とjapanese conditionalsif in japanese
1
[clause]とき、…とき — when
Condition
Clause + とき sets the time: “when …”. The verb tense before とき matters.
日本へ 行くとき、カメラを 買いました。
にほんへ いくとき、カメラを かいました。
When I went to Japan, I bought a camera (before going).
とき = “at the time when”. The form before とき shows timing: 行くとき (dictionary form) = before/while going; 行ったとき (た-form) = after having arrived. Nouns and adjectives connect with の/な/い as usual.
Dictionary form + と = “whenever A, (always) B” — automatic consequence.
この ボタンを 押すと、ドアが 開きます。
この ボタンを おすと、ドアが あきます。
When you press this button, the door opens.
This と joins two clauses where B inevitably/naturally follows A — used for operating instructions, directions and natural laws. The clause before と is always in dictionary (or ない) form.
た-form + ら sets a condition: “if/when A happens, B”.
雨が 降ったら、行きません。
あめが ふったら、いきません。
If it rains, I won't go.
Add ら to the plain past (た-form) of verbs, adjectives and the copula: 降った→降ったら, 安かった→安かったら, 暇だった→暇だったら. It is the most flexible “if/when”, used for one-off, specific conditions.