Implement foreach.