Recent

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

Bart

  • Hero Member
  • *****
  • Posts: 3247
    • 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