Initializing array of TPoint? lazarus / 21-General ---------------------------------------------------------------------- Marion · 2024-02-06 21:14 I am trying to use the code for this Github project: https://github.com/eny-fpc/lazes This is clearly trying to initialize an array of TPoint but I don't understand how this would work or why the compiler is giving the error on line 3: QuoteSyntax error, ")" expected but "," found. 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 const DirMoves: array[TDirection] of TPoint = (  (x:0; y:-1),  // North  (x:0; y:+1),  // South  (x:+1; y:0),  // East  (x:-1; y:0) // West); ---------------------------------------------------------------------- cdbc · 2024-02-06 21:30 Hi It looks like fpc is expecting 1 less than what you've got in your initialization... Are you sure 'TDirection' is of 4 items? Did you forget one while typing...? Did by any chance, an extra comma ',' sneak in the initialization, while you weren't looking?  Otherwise I can't really see, why it should complain... Regards Benny ---------------------------------------------------------------------- Marion · 2024-02-06 21:34 Quote from: cdbc on February 06, 2024, 10:30:47 pmHi It looks like fpc is expecting 1 less than what you've got in your initialization... Are you sure 'TDirection' is of 4 items? Did you forget one while typing...? Did by any chance, an extra comma ',' sneak in the initialization, while you weren't looking?  Otherwise I can't really see, why it should complain... Regards Benny I didn't write this and I do not understand how this initialization works. Here is the definition of TDirection. TDirection = (FromBeginning, FromEnd); ---------------------------------------------------------------------- Bart · 2024-02-06 21:51 Quote from: Marion on February 06, 2024, 10:34:57 pmI didn't write this and I do not understand how this initialization works. Here is the definition of TDirection. TDirection = (FromBeginning, FromEnd); Well, then the array cannot hold more than 2 items... Bart ---------------------------------------------------------------------- jamie · 2024-02-06 22:19 Something must not have translated correctly. The define is 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 TDirection = (dirNorth, dirSouth, dirEast, dirWest);  in unit MAZE. ---------------------------------------------------------------------- Marion · 2024-02-06 22:30 Quote from: jamie on February 06, 2024, 11:19:13 pmSomething must not have translated correctly. The define is 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 TDirection = (dirNorth, dirSouth, dirEast, dirWest);  in unit MAZE. I think I've found the problem then. There is a TDirection in Types and that is what the compiler is looking at, but there is also a TDirection in Maze. I renamed the TDirection (Maze) but I am still getting the same error. ---------------------------------------------------------------------- Marion · 2024-02-06 22:31 I want to thank everyone who has helped me so far. I appreciate it. ---------------------------------------------------------------------- jamie · 2024-02-06 23:28 You have  choice:  Move your units around in the Uses list so maze at after the types unit or do this in the local unit your code is in. Type  TDirection = Maze.TDirection; ---------------------------------------------------------------------- Marion · 2024-02-06 23:35 That worked. I've got the repo working. Now I need to learn what makes it work. Thanks again everyone for helping me debug this.