When having two loops it seems the variables are never show if the name is already used: foreach(string a; x) { // a not shown in the locals or autos} foreach(string a; y) { // a not shown } renaming one of them to b, say, works as long as be wasn't used somewhere else.