You probably should learn the basics of Pascal first as it will give you a solid base to build up your knowledge for Object Pascal. Everything is the same except for the extra OOP stuff.
And you know what? I completely forgot to put up the code structure for a unit. Sorry, I was thinking of doing that, but I guess posting from work has it's pitfalls huh?
[pascal]unit TheNameYouWant;
interface
implementation
end.[/pascal]
Thats it. And example of usage would be...
[pascal]unit TheNameYouWant;
interface
// Global Stuff
uses
Math;
var
gText: String; // Can be accessed by this unit and other units, libraries and programs
// Any optionally globally accessible functions/procedures go here
procedure DoThings; {You only have to declare your local procedures/functions here to use them globally!}
implementation
// Local Stuff
var
lNumber: Integer; // these can only be accessed within this unit!
procedure DoThings;
begin
// Whatever this thing does.
end;
// begin
// If you include a code block at the bottom of your unit
// all of the contents will auto execute. This is handy for
// some unit specific auto initialization, etc...
// Of course this is only optional.
end.[/pascal]
I think you should be fairly good to go with that example. Play around with it and try things. And of course ask if you get stuck.
Bookmarks