문제

Here's what I'm trying to do:

T[1]:=5;
T[2]:=3;
.
.
.
T[9]:=20;

Is there a shortcut to achieving this where I can assign the values in a single line?

도움이 되었습니까?

해결책

I could not find this in any of the documentations but I tried this and it works!

Here's the method used with a complete example:

Program StrangeArray;

Var T: Array[1..5] of Integer = (554,434,144,343,525);
    x:integer;

Begin
For x:=1 to 5 Do
    Begin
    Writeln(T[x]);

    End;

End.

Hope this is useful for others as well.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top