Autor Beitrag
THF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Vista
Delphi 2005 professional
BeitragVerfasst: Sa 26.02.05 19:17 
Hallo,

ich habe ein array of record z.B.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
type 
TWert= array [0..100] of record
Test: integer;
end;
........
var  Wert: TWert;
........

Ich möchte nun zwei array-Variablen denselben Wert zuweisen.
Ich weiß jedoch nicht wie man das ausdrücken kann.
z.B.
ausblenden Delphi-Quelltext
1:
2:
Wert[1].Test := 3;
Wert[3].Test := 3;

oder einer ganzen Gruppe denselben Wert geben:
ausblenden Delphi-Quelltext
1:
Wert[1..5]:= 10;					

Gruß

THF
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 26.02.05 19:23 
Der erste Code stimmt, für [1..5]:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
  i: Integer; //Loop dummy
begin
  for i := 1 {untere Grenze} to 5 {obere Grenze} do
    Wert[i] := 10; //zum Beispiel ;)
end;


So geht's dann :)

AXMD
THF Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 110

Vista
Delphi 2005 professional
BeitragVerfasst: Sa 26.02.05 19:30 
Hallo AXMD,
ich wollte beide Array-Variablen denselben Wert geben,
ohne es zweimal zu schreiben.
ausblenden Delphi-Quelltext
1:
2:
 
 Wert[1,3].Test:= 2;

Gruß

THF
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Sa 26.02.05 19:35 
Das geht leider nicht.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 26.02.05 19:35 
Das geht auch nur mit einer Schleife (wie in meinem Post oben) oder mit zwei separaten Anweisungen.

AXMD