#ForEachFruit.ps1 $var=("apple","banana","pineapple","orange") foreach ($fruit in $var) { $i++ #this is a counter that is incremented by one each time through write-host "Adding" $fruit } write-host "Added" $i "pieces of fruit"