despite its age and cultural irrelevancy in the modern era, pascal is still a great language for learning programming as well as general use and freepascal is available on every OS and compiles very fast to machine code and doesn't have all the weird idiosyncracies and confusing symbol-heavy teletype-influenced syntax that C has and the unit system is a lot less cumbersome and confusing than header files are, and unlike go/rust it also allows for low-level memory management and doesn't abstract it away behind a garbage collector or a borrow checker or smart pointers or other bullshit.
to give an example of why i think pascal is still a good first compiled language, consider the following code:
program Hello;
const
N = 100;
var
Msg: string;
begin
Msg := 'hello';
if N = 100 then
WriteLn(Msg);
end;
end.the const keyword creates actual compile-time constants, variables have to be declared at the top of scope and the name of the variable is written first rather than its type, strings are a native type with proper stored length and bounds-checking, the assignment operator is ":=" instead of equals sign, the equals sign actually means "equal to", the standard library doesn't need to be explicitly included to use the WriteLn() print function, WriteLn() can print variables directly.
and here is c:
#include <stdio.h>
#define N 100
int main() {
const char *msg = "hello";
if(N == 100) {
printf("%s\n", msg);
}
return 0;
}the standard library has to be explicitly included with the #include directive to have access to the printf function, true compile-time constants have to be declared as #define preprocessor macros because const doesn't actually make things constant, types have to be written before variables as well as functions to specify their return type which is a lot less readable when you have a lot of variables declared in a row, there is no string type even in the standard library and you have to declare a pointer to an array of characters and make it const to make the characters read-only (but not actually a real compile-time constant) to prevent the program from crashing with a segfault should anything try to modify the string, also c's ad-hoc char array strings do not store their length and use an i
Post too long. Click here to view the full text.