Cross posted at need help with this basic prob containing loops