Suppose I have 20 Tanks in 3 Warehouses, say 5 in 1st, 7 in 2nd, 8 in 3rd. The exact numbers are not important, only the fact that they are different. For simplicity, those are the tanks from one of the educational videos and they have MaxLevel, MinLevel and Warning triggered if CurrentLevel is out of limits.
Another task I want to implement is to say press a button that would start filling "Big Green Tank" in Warehouse 1, "Small Red Tank" in Warehouse 2 and "That Blue One" in Warehouse 3. Human names here are just for the purpose of addressing some variables in the code by the name that is easily recognized.
So If I do an Db1.Tanks Array [0..19] of Tank, that would allow to easily solve Task 1, that is loop over the array and check for each tank that level is within [Min, Max]
However, the code to Task2 becomes very unclear, that is IF (BUTTON) THEN Db.Tanks[3].State := True;
Db.Tanks[8].State := True;
Db.Tanks[17].State := True;
END_IF; That is numbers 3, 8, 17 you have to remember. Is there a way by using pointers or w/e have an ability to address simultaneously the set of Tank by looping over it or by "string"