Added working function foreach example.