Re: Best ways to declare associative arrays

2017-03-12 Thread XavierAP via Digitalmars-d-learn
On Sunday, 12 March 2017 at 07:58:40 UTC, helxi wrote: string[string] change(ref string[string] arg_array){ //.. arg_array["first"] = strip(readln()); //.. arg_array["second"] = strip(readln()); //.. return def; } Nicholas clarified why your

Re: Best ways to declare associative arrays

2017-03-12 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 12 March 2017 at 07:58:40 UTC, helxi wrote: How would an experienced programmer declare an associative array of strings that has 2 keys? My initial impression was string[string][2] my_array; which does not seem to work. Here is a snippet of the code I am working on: import

Re: Best ways to declare associative arrays

2017-03-12 Thread helxi via Digitalmars-d-learn
On Sunday, 12 March 2017 at 07:58:40 UTC, helxi wrote: return def; I meant return arg_array;

Best ways to declare associative arrays

2017-03-12 Thread helxi via Digitalmars-d-learn
How would an experienced programmer declare an associative array of strings that has 2 keys? My initial impression was string[string][2] my_array; which does not seem to work. Here is a snippet of the code I am working on: import std.string; import std.stdio; string[string] change(ref