Autor Beitrag
kronoide
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: So 28.01.07 13:19 
Hallo Leute :D

also ich hätte hier diesen quelltext:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Timer1Timer(Sender: TObject);
        begin
        Label2.caption := IntToStr(i);
        i := i-1;
        if i=0 then
        begin
         i:= i+0;
        end;
end;

end.


wenn ich aber nun das kompiliere dann bleibt er nicht bei 0 stehen sondern zählt weiter runter
kann mir jemand helfen?

danke schonmal :wink:
Corpsman
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 228

KUbuntu 10.4
Lazarus
BeitragVerfasst: So 28.01.07 13:32 
Globale Variablen .. Böse ..
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1Timer(Sender: TObject);
        begin
        Label2.caption := IntToStr(i);
        If i >0 then 
          i := i-1;
end;


Auserdem wenn du schreibst :
Zitat:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  if i=0 then
        begin
         i:= i+0;
        end;
Macht das überhaupt keinen Sinn, wenn überhaupt dann
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  if i=0 then
        begin
         i:= i+1;
        end;


Wobei die If bedingung besser ist. und dann Würde ich mir Überlegen ob ich bei I = 0 nicht evtl Timer1.enabled := false mache.

_________________
--
Just Try it.
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: So 28.01.07 13:37 
achso :D
vielen dank :wink: