QP School

Full Version: Basic Object Pascal syntax
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.