Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Friday, 16 August 2013

Pascal Programming Lessons-Part 2-Using Free Pascal

            In this part we'll be setting up Lazarus and learning to use it and all it's functions and FPC which is not so complicated to set up, I'll start with Lazarus. I think you all know how to install it, I provided you with the download link in the first part.

            When you open Lazarus (I have no idea wha happens the first time, it was a long time ago) I think a new appplication is already started. If it is go to file New... and then a window will open asking you what do you wan to start. Pictures:



            Now to explain the things in these pictures. I'll skip new unit and form because that is too complicated to explain to begginers in Pascal and programming. I told you to go to New... because there you can choose to start a non-graphical program which is named Program, unlike Application which is a graphical Pascal program which we will cover later. Right now the only thing that is important is for you to know how to start a new non-graphical program in order to study with me and practice on your own. This is where we will start our journey. On the end of each lesson I'll give you a few excercise so you can brush up on your skills. I won't cover saving, everyone knows how to save.

            Once you select Program and click OK in the New ... window you should see this:

Delete all of it we don't need that right now. After you deleted that, I am happy to say now you know how to start making a Pascal program in Lazarus.

Next on FPC, in the previous lesson I provided a link. Once you download it, install and there should be an icon on the desktop to open it. Once you open it a small window will appear you can modify the size by clicking right click on the icon, properties and mess with the things there. I won't cover it here. anyway you should see something llike this:


It's very easy to use, to start a new program in the directory you want, first you'll have to change it. To do that go to file Change dir.... and once you chose a directory, in the same menu click on new. I am happy to say that you know how to make a Pascal program in FPC. That is it for this lesson, if it can even be called one.
In the next part I'll start with the real thing.

Tuesday, 6 August 2013

Programming Lessons-Pascal-Part1-Introduction

            Well, time to learn you guys programming! I won't say it's easy and that you'll do it in no time! These lessons are made for people that have no experience in Pascal, if you have some you can skim through until you come across something you don't know. First of all I have a lot of experience in programming, I've been programming in pascal for about three years already and lately I've been studying Unity (game engine) so that when the time comes, I'll guide you guys into making a game (yes you've heard it). First of all I have to tell you that it will be hard, belive me. At first I was so optimistic that I'll learn programming and make games in a year or so, I was wrong and the only thing that kept me going was the thought that I'll make a game, right now I'm making a game and it's not easy. My point is: if you don't have any experience in programming, don't expect to be making a game in a year, unless you spend all the days in the year studying and excersing programming (I don't think anyone will study the whole year), but don't be discouraged, once you learn Pascal you'll be able to learn other languages in a day or so (every language has something specific about it). Why Pascal, because it's a programming language made for studying. I recommend that you download Free Pascal, in the next part I'll cover the basics in working with it, otherwise download Lazarus, a free pascal IDE which is very good sometimes, but also not so good for some things.

To download Lazarus: click here.
To download Free Pascal also known as FPC: click here.

            There's a funny thing, I wasn't planning to do these lessons at all, but my friends encouraged me because they're interested in programming and making games (say thanks to them).

            LET US START! Finally. Well since this is an introduction, for the finish I'll show you an example of a Pascal program:

program example;
uses crt;
var
   x,y:integer;
   z:integer;
begin
   readln(x);
   y:=5;
   z:=x+y;
   writeln(z);
end.

            That's it for the first part. Be patient the next part is not that far away!
Makrokrama