Pascal is an intermediate-level programming language which is quite versatile. However, if you plan to be a professional programmer, you would probably be better off to go directly from BASIC to C (as I did). Pascal is not used much in the business world anymore, but C is everywhere.
But if you have no intention of going into programming as a job, Pascal is a good language for programming hobbyists. Here are some quick programs to get you started on it. (For a more thorough tutorial on Pascal, check here.)
program hiworld; begin writeln('Hello, world.'); end.
The first line initializes the program. The next one gets it started. The "end." ends the program (note that it has a period after it) and whatever's between the begin and end. is the actual program. That one was pretty easy! :)
program hiworld; procedure showit; begin writeln('Hello, world.'); end; begin showit; end.
This program accomplishes the exact same thing as the first one. However, it does it in a different way. It shows how to use procedures in Pascal. The line procedure showit; begins a procedure (a mini-program within the program) called showit.
The first begin begins the procedure. The end; ends it. The procedure is now defined, and you can use it in the main program (as above) by simply inserting the line showit;. Pretty cool, eh? :>
Note, of course, the use of a semicolon after the end to end a procedure, and a period after the end to end the whole program.
Here's a pascal program which waits for you to type in some text, and then just shows you what you typed:
program readback; var stringname:string; begin readln (stringname); writeln ('You typed ', stringname); end.
Under the "var", variables are defined. Here a variable called "stringname" (catchy name, hey?) is defined as a string, then used to get user input with readln, which is then re-displayed with writeln. Pretty simple, really.
So what variable types does Pascal recognize? Here are the main ones:
string (a string) char (a single character) integer (an integer; a whole number, without a decimal) real (a "real" number, i.e. one capable of having a decimal)
One interesting thing about Pascal is that it lets you (if you're using a good Pascal compiler) write procedures in assembler! Here's a program that shows how:
program pasasm; procedure asmproc; begin asm {YOUR ASM CODE HERE!!!} end; {End asm} end; {End procedure} BEGIN asmproc; END.
This is much the same as the last program, with a procedure that's later called by the main program. The important difference is the line asm right after the procedure's begin. This starts an assembler procedure. Then, you'd put whatever assembler code you want to execute below that, and use an end;. This program must use two end;s, the first to end the assembler part of the procedure, the second to end the procedure itself. Then the main program gets underway.
This should get you started on Pascal; More to come later (I hope).