I do not understand it yet I guess
If you have
var
arrHoogte: array of real;
You always get an array beginning at index 0 (so arrHoogte[0]).
So if you set the number of elements of arrHoogte to 10 you get arrHoogte[0] through arrHoogte[9].
Notice that you DON'T get arrHoogte[10] and you may not use that number.
You can either remember always to use arrHoogte[number - 1] or you can cheat a little and always do SetLength with one number higher then really needed.
So if you change the SetLength(arrHoogte, aantal); to SetLength(arrHoogte, aantal + 1); you CAN access arrHoogte[aantal].
(you have the SetLength in two places in your code at the moment, so change them both)
B.T.W. you don't use arrHoogte[0] at all in that case so it is a waste of space, but for one real that really doesn't matter.
You DO need to remember that a dynamic array is always 0-based because you are going to run into this in the future some more.