Am 2017-04-12 um 16:30 schrieb Ryan Joseph:
>> Array[High(Array)] := whateveryouwant;

> SetLength(Array,Length(Array)+1);
> Array[High(Array)] := …
> In the real world is anyone actually going to type that out every time?

Yes, I do this. Typing is not much work for me.
My main focus is on *readable* code (effort for writing is of low priority).
And the 2 lines show very clear what realy happens.

I can also omit the second line and set a value later
while with an Add-function I have to specify a value
for the new array element even if I just want to extend the array only.
I have finer control about what happens.

> I’d bet most of us have an array class we use and ignore dynamic arrays all 
together because we all need basic operations like “add” and “remove”.

I never use classes.
I like dynamic arrays very much.


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to