Array of Key->Value array -


i starting d language (d2) , trying following:

string[int] slice1 = [ 0:"zero", 1:"one", 2:"two", 3:"three", 4:"four" ]; string[int] slice2 = [ 0:"zero", 1:"one", 2:"two"];  alias myslice = string[int]; myslice[] list; list[] =slice1; list[]=slice2; writeln(list); 

it compiles list stays empty. did miss?

list[] = slice1;

i guess you're expecting append slice1 list, in php. meaning in d is: "assign slice1 each of elements in list." list has no elements, nothing being changed.

for appending, use ~= operator:

list ~= slice1;


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -