Add solution and tests for foreach
Add solution and tests for format