foreach snippet