AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Wieder ein Variablen Problem - komme nicht weiter.
Thema durchsuchen
Ansicht
Themen-Optionen

Wieder ein Variablen Problem - komme nicht weiter.

Ein Thema von AlexII · begonnen am 30. Sep 2008 · letzter Beitrag vom 30. Sep 2008
 
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#7

Re: Wieder ein Variablen Problem - komme nicht weiter.

  Alt 30. Sep 2008, 13:36
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.
Michael
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:35 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz