Iterate over a set or a list.