import Cocoa
/* Create an array of 5 integers */
var myArray = [1, 2, 3, 4, 5]
/* print the array */
print(myArray)
/* using closure, add 1 to each element of the array */
myArray = myArray.map({$0 + 1})
/* print the array */
print(myArray)
Output
[1, 2, 3, 4, 5]
[2, 3, 4, 5, 6]