Formats foreach statement