Autor Beitrag
Snippy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61



BeitragVerfasst: So 18.05.03 19:45 
Hallo!

Ich will, das eine schleife x-mal ausgeführt wird.
X ist hier edit2.text

So funzt das aber nicht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.Button1Click(Sender: TObject);
var a: real;
var i: Integer;
begin

a := strtofloat(edit2.Text);

begin
for i:=1 to a do
Ereignis
end;

end;

end.

Da meckert er wieder mit a rum! Wie kann ich das lösen?

THX

_________________
Carpe Diem!
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: So 18.05.03 19:54 
Hallo!

Snippy hat folgendes geschrieben:
Da meckert er wieder mit a rum!

Und was "meckert" er genau?

Ich würde es so machen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Var
  i,
  a: Integer;
Begin
  a := StrToIntDef (Edit2.Text, 0);

  For i := 1 To a Do
    ;
End;
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 18.05.03 20:03 
a muß eine Variable von einem ordinalen datentyp sein. Float zaählt nicht dazu.

Was ist denn der Nachfolger von 5,569? 5,6 oder 5,57? Integer-Datentypen habe alle einen genau definierten Nachfolge und Vorgänger: 4 - 5 - 6.