Rule 1: 1. إِذَا 'when' and إِذَا بِـ 'when suddenly'
إِذَا when, whenever is followed by a verb in the perfect, even though the meaning is often present or future: إِذَا كَسَرْتَ الْجَوْزَةَ when you crack the walnut. The second verb of the sentence is also a perfect. A different use is إِذَا بِـ and there was, when suddenly: here إِذَا is followed by بِ and a noun in the genitive, and it usually answers a بَيْنَمَا while clause: بَيْنَمَا أَنَا فِي الْحَدِيقَةِ إِذَا بِقِطَّةٍ عَلَى الْجِدَارِ while I was in the garden, suddenly there was a cat on the wall.
إِذَا كَسَرْتَ الْجَوْزَةَ وَجَدْتَ فِيهَا لُبًّا.
idhā kasarta-l-jawzata wajadta fīhā lubban
When you crack a walnut, you find a kernel inside it.
إِذَا دَخَلَ الْمُعَلِّمُ وَقَفَ الْوَلَدُ.
idhā dakhala-l-muʿallimu waqafa-l-waladu
When the teacher comes in, the boy stands up.
إِذَا رَجَعَ أَبِي مِنَ السُّوقِ أَكَلْنَا التُّفَّاحَ.
idhā rajaʿa abī mina-s-sūqi akalna-t-tuffāḥa
When my father returns from the market, we eat the apples.
بَيْنَمَا أَنَا فِي الْمَطْبَخِ إِذَا بِقِطَّةٍ عَلَى الْمَائِدَةِ.
baynamā anā fi-l-maṭbakhi idhā bi-qiṭṭatin ʿala-l-māʾidati
While I was in the kitchen, suddenly there was a cat on the table.
بَيْنَمَا هُمَا يَأْكُلَانِ إِذَا بِأَبِيهِمَا قَدْ وَقَفَ عِنْدَ الْبَابِ.
baynamā humā yaʾkulāni idhā bi-abīhimā qad waqafa ʿinda-l-bābi
While they were eating, suddenly there was their father standing at the door.