program ideone; var myArray : array of Integer; currentIndex : Integer; begin // Initialize the dynamic array (e.g., with a starting size) SetLength(myArray, 1); // Add elements (example) myArray[0] := 1; currentIndex := 0; // Add a new element SetLength(myArray, currentIndex + 2); myArray[currentIndex + 1] := 2; currentIndex := currentIndex + 1; writeln(myArray[currentIndex ]) end.