[fpc-pascal] Copy dynamic array

Maciej Izak hnb.code at gmail.com
Tue May 15 12:06:26 CEST 2018


2018-05-14 11:46 GMT+02:00 Torsten Bonde Christiansen <tc at epidata.info>:

> SetLength(NewArray, Length(OldArray));
> for i := Low(OldArray) to High(OldArray) do
>   NewArray[i] := OldArray[i];
>

you can just use :

NewArray := Copy(OldArray);

looks better ;)

-- 
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180515/9f3b5f2d/attachment.html>


More information about the fpc-pascal mailing list