unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function Kwadrat(argument: Integer): Integer;
var wartosc :Integer;
begin
wartosc:=argument*argument;
Result:=wartosc;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  x,y :Integer;
  sy :String;
begin
x:=1234;
y:=Kwadrat(x);
y:=Kwadrat(y);
//if y<0 then raise Exception.Create('Zmienna y wygląda podejrzanie!');
sy:=IntToStr(y);
ShowMessage(sy);
end;

end.
