Write program to to find out the average of all the numbers from the array

var numbers = [5,6,3,2,4,8,1,0] var sum = numbers.reduce ( 0,//from ww w . j a v a2s. c o m { (sum: Int, num: Int) -> Int in return sum + num } ) var average = Double(sum) / Double(numbers.count) print(average)

- Closures
- Using Closures
- Assigning Closures to Variables
- Writing Closures Inline
- Using Closures In Your Functions
- Type Inference in closure
- Closure Shorthand Argument Names
- Operator Function in closure
- Trailing Closures