generate unique variable names?

Nicolas F. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 8 02:08:23 PDT 2014


On Wednesday, 8 October 2014 at 02:53:08 UTC, K.K. wrote:
> On Wednesday, 8 October 2014 at 02:06:28 UTC, Brian Schott 
> wrote:
>>
>> I'm 99% sure you actually want an array or associative array. 
>> Something like this maybe?
>>
>> ImageType[string] images;
>> images[format("image%03d", i)] = new 
>> ImagefromFile(userDefinedLocation);
>
> oooh okay I see what you mean. Yeah that will be waaaay better.
> It'll help me get rid of all my extra temp variables and
> string/int conversions, too.
>
> Thanks! :)

Since you're actually already using indexes in the name, you
might as well use a regular array of the appropriate size



More information about the Digitalmars-d-learn mailing list