label
AfterLoops;
var
Array1, Array2: TArray<Integer>;
Value1, Value2: Integer;
FirstMatchValue: Integer;
begin
Array1 := [1, 2, 3];
Array2 := [2, 3, 4];
//没有带标签的 break:跳出嵌套循环需要 goto 或标志
FirstMatchValue := -1;
for Value1 in Array1 do
for Value2 in Array2 do
if Value1 = Value2 then
begin
FirstMatchValue := Value2;
goto AfterLoops;
end;
AfterLoops:
//firstMatchValue is 2
WriteLn(FirstMatchValue);
end.