naming a variable at runtime

InfinityPlusB via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 12 21:32:41 PDT 2014


On Tuesday, 13 May 2014 at 04:26:04 UTC, Ali Çehreli wrote:
> On 05/12/2014 08:47 PM, InfinityPlusB wrote:
>
> > I want to be able to name the rows, as they are built.
>
> First, no, you cannot name variables at run time because 
> variables are concepts of source code; they don't exist in the 
> compiled program.

That's good to know, I'll stop trying to make that happen. :P

> Here is the inner loop with minimal changes to your program:
>
>    int[][] bob;                        // <== Array of arrays
>
>    foreach(line; readInFile.byLine())
>    {
>        int[] row;                      // <== Make a new row

yup, that will work.
If I wasn't hell bent on naming variables, I probably would have 
figured this out. :P

Thanks.



More information about the Digitalmars-d-learn mailing list