code compiles and runs for single execution sans outer loop.