QP School
User-defined functions in Object Pascal - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: Object Pascal Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=50)
+--- Thread: User-defined functions in Object Pascal (/showthread.php?tid=5045)



User-defined functions in Object Pascal - Qomplainerz - 07-25-2023

function Multiply(x, y: Double): Double;
begin
  Result := x * y;
end;

begin
  // Variable declaration
  var
    result: Double;
    a: Double := 2.5;
    b: Double := 3.7;

  result := Multiply(a, b);

  WriteLn('Result of multiplication:', result:0:2);
end.