[fpc-pascal] Hello, new Pascal programmer. had a question!
James Richters
james.richters at productionautomation.net
Sat Aug 28 21:15:13 CEST 2021
I write almost all console programs with FreePascal and also use the Freepascal IDE a lot.
It is compatible with Turbo Pascal and that is what I learned to program with … because it was modern at the time 😊 So turbo pascal books are a good way to learn Pascal in general, as I had no problem using advanced Free Pascal things with a Turbo Pascal background… however I should point out that I am biased toward Turbo Pascal because I have been using it since the mid 80’s, but Object Pascal which is an extension of Pascal is quite a bit more popular and provides Object oriented features like classes and methods… so while Turbo Pascal is a good way to get started with general pascal syntax and understanding the general way things work in Pascal, it would be a good idea to move into Object Pascal and get familiar with that as well.
There is a tutorial here:
https://wiki.freepascal.org/Basic_Pascal_Introduction
The above tutorial has this link: https://wiki.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines
Which does have some links to books for Free Pascal without Lazarus
Free Pascal has some compiler options to make it compatible with various forms of Pascal, one of them is Turbo Pascal, but if you compile the program with the wrong one, you may ger unexpected errors. So if you want to use a Turbo Pascal book, you should put {$Mode TP} at the top of your program to instruct the compiler to compile it as a Turbo Pascal program. You can see the other modes here:
https://www.freepascal.org/docs-html/user/userse33.html
If you do not specify a mode and did not change the default in the configurations, I believe you will get {$Mode FPC}
As far as screen output goes, if you put Uses CRT at the top of your program (under the {$Mode TP}) then you will be using the CRT unit, that handles the screen much the way Turbo Pascal does.. but it didn’t need the unit because that’s all there was… with that, you can use the ClrScr; command to clear the screen first thing, then your program output is the only thing to see… When using the IDE I also put something like a ReadLn; at the end of my program so I can see the results before it switches back to the IDE.. Although pushing ALT-F5 will also show you the output if you don’t have the ReadLn;
{$Mode TP}
Uses CRT;
Begin
ClrScr;
WriteLn('Hello World');
ReadLn;
End.
James
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of joseph turco via fpc-pascal
Sent: Friday, August 27, 2021 4:02 PM
To: fpc-pascal at lists.freepascal.org
Cc: joseph turco <italian.pepe.32 at gmail.com>
Subject: [fpc-pascal] Hello, new Pascal programmer. had a question!
Hello all,
I am a new programmer, and I thought I'd learn Pascal. I saw that with FreePascal, most users are using Lazarus. I don't want to use this and would rather work in the console, and use the free pascal IDE. I'm not really interested in using any GUI tools. I was looking for a book that teaches free pascal without the GUI stuff, that has a lot of examples in it, but i cannot find anything of the sort. This has made me turn to Turbo Pascal books, and i am currently reading "Learn Turbo Pascal in three days". When i use the free pascal IDE to write code, and compile it, i have no issues. When i go to run my program, any text i have printed, will mix in with the terminal/console text, and doesn't just print at the bottom like i would expect. This has made me turn to using emacs, and then just compiling the code in the terminal using "fpc -Mtp <filenname.pas>". My question is, id like to use the free pascal IDE, and learn the more modern(?) form of pascal, but i cannot find a resource for beginners that will teach me with a lot of examples, and not walls of text, just for non-GUI applications. Does anyone know if such a book exists? Many thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210828/025c3017/attachment-0001.htm>
More information about the fpc-pascal
mailing list