Further proof that I’m right about Pascal typed variables

Specifically pre-initializing arrays in the const section. Wasn’t even looking for this… honest. But I decided it’s probably best that I teach myself Pascal OOP, rather than listen to an instructor who is not particularly interested in doing things new ways… because it might break his code.

So I have this Pascal book in my collection, I thought I might look at to learn Pascal OOP…

And what do I read right in the beginning on Page 4? The author says use the {$J-} switch in all modern sources. Which I point out here, that Embarcadero recommends. I even used it (the long version) myself in the last image I showed.

However Huw recommends (in the course) that you pre-initialize arrays in the const section. So he edits his provided program. Then he adds the line “InitArray[2]:=’xxx’;” proving that you can still change it. My point was but it’s a constant and you shouldn’t be allowed to change it! So as you see below when I add the {$J-} switch that Embarcadero and now this author recommends. His example doesn’t work! In other words a const actually acts like a const. Imagine that!

All you have to do to make his code work in the above scenario is move the definition to the var section. Which I asked him several times “Is there any reason that you don’t move it there?” And he never really answered me.

I do it this way… damn it. You’re just a student. Don’t tell me there are better ways…I’ve been programming in Pascal since the mid 1980’s. Better… Schmetter.