QP School
Basic Object Pascal syntax - 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: Basic Object Pascal syntax (/showthread.php?tid=5041)



Basic Object Pascal syntax - Qomplainerz - 07-25-2023

program SyntaxExample;
begin
  // Variable declaration
  var
    age: Integer;
    height: Double;
    name: String;

  // Input from user
  WriteLn('Enter your name:');
  ReadLn(name);

  WriteLn('Enter your age:');
  ReadLn(age);

  WriteLn('Enter your height (in meters):');
  ReadLn(height);

  // Output to screen
  WriteLn('Name:', name);
  WriteLn('Age:', age);
  WriteLn('Height:', height:0:2, 'm');
end.