Und wie kannst du da erkennen, welches
end zu welchem
begin gehört?
Was ist besser lesbar? Deins:
Delphi-Quellcode:
procedure TForm1.Note;
var note, cache: Real;
begin
if (FiCountCorrect=0) and (jkeins=1) and (jkzwei=1) then
begin
note:=7;
end else if (FiCountCorrect=0) and (jkeins=1) then
begin
note:=65/10;
end else if (FiCountCorrect=0) and (jkzwei=1) then
begin
note:=65/10;
end else if (FiCountCorrect=0) then
begin
note:=6;
end else if (jkeins=1) then
begin
note:=cache;
note:=note+1/2;
end else if (jkzwei=1) then
begin
note:=cache;
note:=note+1/2;
end else
begin
note:=cache;
note:=note-5/15;
end;
cache:=note;
Label7.Caption:=FloatToStr(RundeAufStelle(cache, 1));
end;
Oder meins:
Delphi-Quellcode:
procedure TForm1.Note;
var
note, cache : Real;
begin
if (FiCountCorrect = 0) and (jkeins = 1) and (jkzwei = 1) then
begin
note := 7;
end
else if (FiCountCorrect = 0) and (jkeins = 1) then
begin
note := 65 / 10;
end
else if (FiCountCorrect = 0) and (jkzwei = 1) then
begin
note := 65 / 10;
end
else if (FiCountCorrect = 0) then
begin
note := 6;
end
else if (jkeins = 1) then
begin
note := cache;
note := note + 1 / 2;
end
else if (jkzwei = 1) then
begin
note := cache;
note := note + 1 / 2;
end
else
begin
note := cache;
note := note - 5 / 15;
end;
cache := note;
Label7.Caption := FloatToStr(RundeAufStelle(cache, 1));
end;
Und dann sieht man auf den ersten Blick den Grund der Warnung.