NASutils Knowledge BaseUnofficialPolski

Pascal · lesson 6 of 30 · First stepsAsk the user

ReadLn reads a line of text, or several numbers on one line.

Programming on the NAS › Pascal in 30 lessons

06-input.pas Download 06-input.pas

program Input;
var
  Name: string;
  Disks, Size: Integer;
begin
  Write('Your name: ');
  ReadLn(Name);
  Write('Disks and TB in each: ');
  ReadLn(Disks, Size);
  WriteLn('Hello, ', Name);
  WriteLn('Together the disks have ', Disks * Size, ' TB');
end.

Terminal

$ ./06-input
Your name: Ann Example
Disks and TB in each: 4 8
Hello, Ann Example
Together the disks have 32 TB

Exercise

Ask for a year and print how old a disk from that year is.