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 Functions as First Class Citizens

john ledesma
john ledesma
6,944 Points

Can someone please help me with this problem, I am not sure what is wrong. This compiles in playground.

func addTwo(a: Int) -> Int { return a + 2 } let addition = addTwo addition(2 + 9 ) let result = addition

functions.swift
// Enter your code below
john ledesma
john ledesma
6,944 Points

Found the answer :)

let addition = addTwo let result = addition(5)

https://teamtreehouse.com/community/im-having-difficulty-with-the-challenge-write-a-function-named-addtwo-task-1-of-2

also Sorry I did not Format my code correctly.

Anthony Boutinov
Anthony Boutinov
13,844 Points

For the future, you can edit your posts/comments on this forum, so even if you forget to format code you can always do it afterwards. =)