PROCEDURES AND FUNCTIONS
The variables declared under 'var' are local variables and are only available in this procedure. This declaration may not be at all, e.g. when using only global variables (not recommended).
procedure for drawing a circle by specifying the coordinates of the centre, the radius and the size of the blue component (0 255) as the fill.
procedure TForm1.circle(a, b, r, kolor: integer);
canvas.brush.color := RGB(0, 0, kolor);
canvas.ellipse(a+r, b+r, a-r, b-r);
Variables declared in "var" are local variables and available only in this function. This declaration may not be at all, e.g. when using only global variables. Instead of deriving the result of a function through "result" it is possible to substitute the name of the function, which then takes over the properties of the variable.
Example: the function determines the colour in the RGB convention using the TColor type.
function TForm1.RGB(r,g,b: byte):TColor;
result:=(b shl 16) or (g shl 8) or r;
The procedures and functions described must have their own headings in the public section. The names must then not contain an assignment to a form.
Procedures and functions are called by entering their names with current parameters.
Example: the use of the „circle” procedure and the „RGB” function