Challenge A: Repeating yourself

Your first challenge is to write a function that will run a given closure a given number of times.

Declare the function like so:

func repeatTask(times: Int, task: () -> Void)

The function should run the task closure, times number of times.

Use this function to print "Swift Apprentice is a great book!" 10 times.

results matching ""

    No results matching ""