Pascal Tutorial #5
---
This tutorial is on procedures and functions
(sorry for the delay D
==procedures==
A procedure is a section of code that the main program calls up. Procedures help to keep your code neat.
an example:
procedure welcome; //procedure begin writeln('welcome to the program'); end; begin welcome; //calling it end.
as can guess the "procedure" is what you sue to define a procedure and the "welcome;" is what you use to call the procedure welcome.
==functions==
The difference between a function and a procedure is that a function can return a value.
An example of a function:
function cubed(var x:integer):integer; //naming it begin cubed := x*x*x; //cubing the number end; var number: integer; begin //start the program writeln('enter a number'); readln(number);// V using the function 'Cubed'. writeln('the number cubed is ', cubed(number)); end.
Take a look at the comments it's pretty self explanatory if you know how procedures work :3
---
next: loop, soooo totally forgot about those xD I'll do that soon :p
Offline
I just made my first "Hello World" program with lazarus yeah
Offline
I read your tutorials, but I'm a beginner and don't know many things about pascal
so I used the youtube tutorial which you recommended to technoguyx
Offline
Does anyone know any port tutorials?
edit: nvm found something, if anyone is interested http://delphi.about.com/od/networking/N … Delphi.htm
also look at this http://wiki.lazarus.freepascal.org/Networking
Last edited by slinger (2012-02-24 08:14:33)
Offline
Pascal Tutorial #6
---
This tutorial is on loops
Loops as you probably already know repeat xD
==repeat until loop==
i := 1; repeat i := i+1; until i = 10;
As you can see this code here repeats until i = 10.
==for loop==
for i := 1 to 5 do begin writeln(i) ; end;
this repeats without you having to increment
==while loop==
while i = 10 do begin i = i+1; end;
this repeats, you must increment or you'll go into an infinite loop.
Those are the main loops :3
---
next I have no idea xD
Offline