void main() { auto result = readconfig(); foreach (_; result) { // I want to iterate result that I got from structure. } } auto readconfig() { struct ConfigStruct { string key1; string key2; } ConfigStruct confstruct = ConfigStruct(); confstruct.key1="Ivan"; confstruct.key2="admin"; return confstruct; }