if matrice2 = ' ' then // Es-ce possible d'une autre
idx:=0; // façon?
Oui en sortant de la boucle avec l'instruction Break.

While True do
begin
if matrice2 = ' ' then
...