Нужно найти ошибку в коде

tim537

Statement expected but 'var' found - такая ошибка
unit Unit1;
 
interface
 
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
 
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button2: TButton;
Label5: TLabel;
Label6: TLabel;
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
 
var
Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
case Key of
'0'..'9' : ;
#8 : ;
#13 : Edit2.SetFocus;
end;
end;
ВОТ НА ЭТОТ УЧАСТОК РУГАЕТСЯ-----------------
procedure TForm1.Button1Click(Sender: TObject);
begin
var
dist : integer;
min,rain : integer;
sek : real;
v: real;
begin
 
dist := StrToInt(Edit1.Text);
min := StrToInt(Edit2.Text);
sek := StrToFloat(Edit3.Text);
 
if (dist = 0) or ((min = 0) and (sek = 0)) then
begin
ShowMessage('ГЌГ*äî Г§Г*Г¤Г*ГІГј äèñòГ*Г*öèþ ГЁ âðåìÿ.');
exit;
end;
 
v := (dist/1000) / ((min*60 + sek)/3600);
 
label5.Caption := 'ÄèñòГ*Г*öèÿ: '+ Edit1.Text + ' Г¬' + #13 +
'Âðåìÿ: ' + IntToStr(min) + ' ìèГ* ' +
FloatToStrF(sek, ffGeneral,4,2) + ' ñåê ' + #13 + 'Ñêîðîñòü: ' +
FloatToStrF(v,ffFixed,4,2) + ' ГЄГ¬/Г·Г*Г±';
end;
end;
procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
case Key of
'0'..'9' :;
#8 : ;
#13 : Edit3.SetFocus;
 
else Key :=Chr(0);
end;
end;
---------------------------------------------------
procedure TForm1.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
case Key of
'0'..'9' : ;
',','.':
begin
Key:=DecimalSeparator;
if Pos(DecimalSeparator,Edit3.Text)=1 then Key := Char(0);
end;
#8 : ;
#13 : Button1.SetFocus;
else Key :=Chr(0);
end;
end;
 
end.
1 ответ

tim537

Строки 49 и 74 убери.