noob Q: array out-of-range

Duke Normandin dukeofperl at ml1.net
Fri May 28 17:42:53 PDT 2010


On Fri, 28 May 2010, bearophile wrote:

> Duke Normandin:
>
> > This is the site that I'm using to learn D. If you scroll down 3-4
> > screens full, you'll come to the "array" topic. Is this tutorial
> > outdated, wrong, or what, because it doesn't deem to sync with what
> > you two fine fellows are telling me about creating dynamic arrays in
> > the D-Language. TIA..
>
> That part of that tutorial is not outdated, as far as I know it's just wrong.
> You can auto-create slots in associative arrays:
>
> int[int] aa;
> aa[0] = 1;
> aa[1] = 1;
> aa[2] = 1;
>
> Lua language uses associative arrays instead of arrays :-)
>
> Bye,
> bearophile
>


So these two paragraphs in the tutorial are flat out wrong?

[quote]
You should note that I never specified how long the array should be.
Instead I simply assigned values to various positions in the array and
it just worked.
This is an example of a dynamic array. It will grow to whatever size
is required. I can determine the size of an array at any time by
accessing the array's length property. The length property can also
have a value assigned to it to resize the array.
[/quote]

Maybe the link for this tutorial at:

http://www.prowiki.org/wiki4d/wiki.cgi?FirstLanguage

should be removed?

-- 
duke


More information about the Digitalmars-d-learn mailing list