Array assignment

From: Jaco van Niekerk (sparky_at_lantic.net)
Date: 10/28/03


Date: Tue, 28 Oct 2003 23:53:07 +0200

Hi all

I'm mostly a Java coder, but I'm trying to get my Delphi knowledge back on
to par. I've got the following question. Let's say we define a dynamic
array. How do you assign values to the array in a condensed form?

var
  A: array of Integer;

begin
  SetLength(A, 100);
  A[0] := 3;
  A[1] := 5;
  ...
  A[99] := 12;
end;

Clearly this is clumsy!, can't I just do something like

A := (3, 5, ..., 12);

instead of all the A[i] := x ??

Please help!
Rgds
Jaco



Relevant Pages

  • Re: cut from string using JScript
    ... Or unless you add your own support for it to the Array prototype. ... Array Power, Part II ... bringing the IE Array object up to par ...
    (microsoft.public.scripting.jscript)
  • Why scalar /= dimension(1)) ? for intent(inout) dummy arg
    ... a scalar as an actual argument, it fails to compile with the error ... The shape matching rules of actual arguments and dummy arguments have ... Just make the actual argument an array. ... real*4 function interpolated(xi, yi, x, par) ...
    (comp.lang.fortran)
  • Re: cut from string using JScript
    ... > Or unless you add your own support for it to the Array prototype. ... > bringing the IE Array object up to par ...
    (microsoft.public.scripting.jscript)