It also works: ----- import std.conv; import std.stdio; import std.string;
struct Human { string name; ushort age; } void print_human_list(Human[] human_list) { foreach(human; human_list) { writeln(human.name); writeln(human.age); } writeln(); } void add_new_human(ref Human[] human_list) { write("Name: "); string name = readln.strip; write("Age: "); ushort age = readln.strip.to!ushort; Human tmp_human = {name, age}; human_list ~= tmp_human; } void main() { Human[] human_list; for(;;) { writeln("A)dd New Human."); writeln("P)rint Human List."); writeln("Q)uit."); write(": "); char choice = readln.strip.to!char; switch (choice) { case('A'): add_new_human(human_list); break; case('P'): print_human_list(human_list); break; case('Q'): return; default: continue; } } } ----- http://ideone.com/0cS7Y4