Discussion on:

Message 140 of 310
0 Votes
+ -
OK...
Bottom up structure is not a problem, it actually makes Pascal easier to parse (remember that this is one of the original intention of its invention) while making it easier to spot scopes. program block differs a little with function/procedure block (only in its header), and nested function/procedure is supported. In fact, every function/procedure declared inside the program are nested to the program block. And if you really want, top down structure can be emulated with forward declaration.

The pseudo block structure is more or less acceptable, depends on how one looks and react at it. This is one of some points usually addressed in Pascal coding guide with resolution: "always put begin - end pair, even if it only consists of one statement"

Finally, how would you say that

Program Hello_World
Write (Unit=*,Fmt=*) "Hello, World!"
End Program Hello_World

is easier to explain and understand than

program HelloWorld;
begin
WriteLn('Hello World');
end.

Surely you'll have to explain the Write (Unit=*,Fmt=*) part, and I don't think it's easy for students to catch. Pascal does it more straight happy
Posted by leledumbo
30th Jun