Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAdrian Yeow
13,866 PointsReturn Void
func printerFunction() -> (Int) -> () { var runningTotal = 0 func printInteger(number: Int) { runningTotal += 10 println("The running total is: (runningTotal)") } return printInteger } The () has shown that this function is returning void. If it's returning void, than why is return printInteger is required?
1 Answer
Alp Eren Can
25,230 PointsHi Adrian,
In fact, printerFunction is not returning Void, it's returning a function that has one parameter of type Int, and that returns a value of type Void.
The second ->
is part of the statement of printerFunction's return type.
Hope it helps.