Working with foreach loops