May 2004
Intermediate to advanced
888 pages
22h 31m
English
As a programmer, you should already be familiar with the basics of procedures and functions. A procedure is a discrete program part that performs some particular task when it’s called and then returns to the calling part of your code. A function works the same except that a function returns a value after its exit to the calling part of the program.
Listing 5.1 demonstrates a short Delphi program with a procedure and a function.
1: program FuncProc; 2: 3: {$APPTYPE CONSOLE} 4: 5: procedure BiggerThanTen(I: Integer); 6: { writes something to the screen if I is greater than 10 } 7: begin 8: if I > 10 then 9: writeln('Funky.'); 10: end; 11: 12: function IsPositive(I: Integer): ... |
Read now
Unlock full access