[fpc-pascal] Array clearing

Jürgen Hestermann juergen.hestermann at gmx.de
Wed Apr 12 16:24:28 CEST 2017


Am 2017-04-12 um 15:46 schrieb Ryan Joseph:
 > I agree. Dynamic arrays only advantage is they are managed by the compiler but they’re missing obvious functionality like adding/removing elements so they’re usually pretty useless.
 > Why was the functionality of appending an element to the end never added? That’s one the most basic operations for arrays.

It exists:

SetLength(Array,Length(Array)+1);

You will get an additional element (filled with zeros).
Then you can set

Array[High(Array)] := whateveryouwant;



More information about the fpc-pascal mailing list