The average value of an Array made easy

Instead of writing methods that sum up all values in the array and divide it by number of entries, there is an easier way to find the average. KVC (Key-value coding) collection operators can be used for it. To find the average value of the array that contains numbers @avg operator can be used:



One Response
  1. bmo

Leave a Reply

Your email address will not be published. Required fields are marked *