Static and dynamic array as Parameters for Function lazarus / 21-General ---------------------------------------------------------------------- Weitentaaal · 2021-05-03 14:38 Hello Guys So lately i tried to write a Sorting algorithm for my ListBoxes, bc i need them to be sorted by Relevance. So i have like 26 Classes where i call this Sort algorithm but i always have a different Length of my Array. How do i pass a Static array to a Fucntion wich recieves Dynamic Arrays, or do i have to bring Length also as Parameter ? what i have right now : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   //Definitions  SelectedZubehoer = record     Name : String;     Ausgewaelt : Boolean;     ID : Integer;  end;   TSelZub = Array of SelectedZubehoer;   //Call  myGlobalClass.SortZub(SelZub, ZubListe1, ZubListe2);   //Function  Procedure SortZub(SZ : TSelZub; var zubliste1, zubliste2 :   TListBox);   begin    ZubListe1.Clear;   ZubListe2.Clear;    //Sorting end;  How should i do it ? ---------------------------------------------------------------------- lucamar · 2021-05-03 15:31 Use open array parameters. You can then pass any array to it, whether static or dynamic. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   //Function  Procedure SortZub(SZ : Array of SelectedZubehoer;       var zubliste1, zubliste2 : TListBox);   begin    ZubListe1.Clear;   ZubListe2.Clear;    //Sorting  end; Note that it's not the same as using: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Procedure SortZub(SZ : TSelZub; ...)since in this case the rules for type compatibility become more strict.