You did not count the begin
and end
correctly and the mistake in your code is really obvious. It is worrying that you cannot solve this problem on your own for 4 days (looking at dates at this forum thread).
Please perform the exercises below. Please do them all, don’t respond with incorrect statements like “heck, I know my code is correct” (your code is obviously not correct, the compiler is right). Please don’t skip any of the steps below. If you really want to learn, then please do these exercises to learn how to solve such issues in the future. Post your results in this thread.
-
Go through the code you posted yourself in the post where you wrote “You omitted the last few lines that ended the block properly:” :
Need Help Making Collision with Ground Work Correctly - #87 by JPF12141999
Write down how many times the word “begin” occurs there.
Write down how many times the word “end” occurs there.
Is the count of “begin” and “end” equal?
-
Use a text editor, like Lazarus or VS Code or really anything else, to search (using usually Ctrl +F shortcut) for “begin” in that piece of code. Count the “begin” occurrences this way.
Similarly, count the “end” occurrences with the help of your text editor.
Is the count of “begin” and “end” equal? Are the results equal to your manual counting from AD 1?
-
As has been pointed out to you above, indent your code correctly. Modern Object Pascal Introduction for Programmers | Castle Game Engine and many other Pascal resources show how to do this. Your code is not formatted correctly.
There are some variations how to make proper indentation, but the basic approach I most often saw with Pascal is:
- lines after
begin
are indented by 2 more spaces. - ending a block with
end
moves back the indentation by 2 spaces less. - in effect, all matching
begin
andend
should land on the same column. This should let you spot the mistakes trivially easily, without even needing to count like we did in AD 1 and AD 2.
If the above description of indentation is unclear to you, look at the examples, from Modern Object Pascal Introduction for Programmers | Castle Game Engine , from CGE examples. They all follow these conventions.
- lines after
-
At this point you really should be able to solve the compilation error, at least the one with begin…end mismatched (I don’t know if you have other errors).
You should still learn about
begin..end
blocks, as your code has 1 unnecessary block, and I suspect you don’t know where it is and why it is unnecessary. Follow all resources linked from More Resources to Learn Pascal | Castle Game Engine , read and watch there everything, until you understand it.
Note: I don’t give you ready solutions and answers above, because it doesn’t seem useful to me – it is another long thread from you, and it seems you do not know how to do very basic programming tasks. You need to learn them, I hope above pointers will be useful.