* * *

Author Topic: Populate a dynamic array  (Read 3794 times)

Bart

  • Hero Member
  • *****
  • Posts: 3050
    • Bart en Mariska's Webstek
Re: Populate a dynamic array
« Reply #30 on: May 02, 2018, 08:25:06 pm »
Strange...Since the succ() should not be related to the high in any way at all, but just take the value and return High + 1.
And the inner evaluation has precedence. Or maybe I fell unto my own trap: counting from zero  8-)
Yes, you fell unto your own trap!

If Length(arr) = 1, then High(arr) = 0 and Succ(High(arr)) will be 0+1 = 1.
As bytebites pointed out: for dynamic arrays, High() will be the same as Pred(Length()).

It's elementary.

Bart

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus