Testing basic syntax of Pascal
{ Start of script }
// Pascal comments are weird
{ This type of comment is even weirder, similar to (* *) in CAML }
program aboutPage(output);
begin
asm 0101000 10101010 00011000 01101100 { Assembly data? } // I know this line is not functional, take it out upon testing
write('about:blank')
write('Lorem ipsum')
helloWorldOnTwoLines(); { DO NOT USE return }
break
end.
function helloWorldOnTwoLines();
begin
write('Hello-')
continue.
write('-world')
break; // Semicolons are recognized as null statements and are not needed
break;
end.
/!\ This example has not been tested yet, and may not work
I need feedback on any problems with this, this is basically all my Pascal knowledge as of 2021 Friday September 24th
These are 2 types of comments in Pascal:
Block comments:
{ Block comment }
{ Write like
this as well } // I am not sure if this works
/!\ This example has not been tested yet, and may not work
and Single Line comments:
// Single line comment
This is a simple Hello World program in Pascal:
begin
write('Hello World')
end.
/!\ This example has not been tested yet, and may not work
This is a simple function in Pascal:
function helloWorldOnTwoLines();
begin
write('Hello-')
continue.
write('-world')
break; // Semicolons are recognized as null statements and are not needed
break;
end.
/!\ This example has not been tested yet, and may not work
break
To this day, I am still not entirely sure what the break
keyword does, but most languages support it.
/!\ This example has not been tested yet, and may not work
-
Most early Macintosh software was written in Pascal
-
Pascal is NOT a curly bracket and semicolon language
-
Pascal uses the
.pas
file extension, or the simpler.p
file extension -
Pascal is similar in syntax to FORTRAN with the
begin
andend.
blocks -
No other knowledge of Pascal to list.