I already converted your whole app for dynamic arrays...
Oops sorry, i mixed with another
very similar thread. It shows some use of dynamic arrays though.
How could i improve this? I don't understand how it is illogical.
Lets say we have 5 different schools A, B, C, D, E, and we want to make simple array database of all the students in them. Would you go with 5 arrays "StudentA, StudentB...StudentC"? It is simpler to make with 1 array "student". For example a record:
type
TStudent = record
name, school: string;
// add more data if needed...
end;
PStudent = ^TStudent;
var student: array of TStudent;
// Add 1 student
procedure AddStudent(const name, school: string);
var index: integer;
begin
setlength(student, length(student)+1); // Increase array size by 1
index:=high(student);
student[index].name:=name;
student[index].school:=school;
end;
// Print all students that study in school that is given in parameter
procedure PrintCertainSchool(const school: string);
var i: integer;
begin
writeln('Students in ', school);
for i:=0 to high(student) do
if student[i].school=school then
writeln(i, '. ', student[i].name);
// Notice how i use indents to tell there starts a code block.
// Every time there's 2 spaces, i could use begin..end pair if more
// lines would be required.
end;
And other thing that is illogical is the use of indents, there are spaces here and there. Lazarus converts them to spaces automatically, so it's certainly not a tab character messing with forum.
Other than that, you have written more code than before (we don't know what the program does at all), so giving more assistance might require posting the entire code again.