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 trialOmar De Yamlor
10,980 PointsPassing in the constant rather than the function name ?
Hi,
I am wondering why it is that you pass the constant doubleFunction rather than the function name double within the inline closure ?
1 Answer
Addison Francisco
9,561 PointsI believe he is trying to expand on functions being โfirst class citizensโ in this example, which is why he did a round about implementation by first assigning a function to a constant. You are correct in saying that you could instead pass the literal function name into the closure to achieve the same result. He is just trying to expound on how functions and closures work in a wholistic way to help students understand what is going on with closures. A lot of his lessons will show you how to achieve the same result by working out multiple approaches.