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 trial

iOS Closures in Swift 2 First Class Functions Review: First Class Functions

Darcy Phillips
Darcy Phillips
4,087 Points

higher order function question

The question is:

A higher order function is a special function that only takes certain parameter types.

I answered true. I don't understand why my answer is not accepted as correct. A higher order function is in fact one that only takes certain parameter types, those parameter types being: ones that have function signatures. If the function does not take function signatures as one of it's parameter types then it's not a higher order function. Is that not true?

2 Answers

Oliver Duncan
Oliver Duncan
16,642 Points

You're right in a way, but it doesn't only take parameters with function signatures. It can also take any number of other parameters of different types. In other words the only requirement for a function to be a higher order function is that it either takes a function, or returns one, or both - it doesn't restrict its parameter types to only functions.

Darcy Phillips
Darcy Phillips
4,087 Points

Ah, now I see what they're getting at with that. Thank you for that clarification!