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 trialJohn Salamon
515 PointsShouldn't call the println directly should be in the body of your function
func greeting() { let greeting = "Hello" println("greeting")
} greeting()
Getting an error that 'Should not call println directly should be in the body of your function.....error
The example code is very different and the exercise badly matches the previous video, can anyone help..... Functions
3 Answers
Marcio Mello
7,861 PointsI am glad it did work on Xcode. In the end, that is what matters ;) As for workspaces, I have not tried Swift in it yet. Sorry that I can not help with that issue.
John Salamon
515 PointsSorry to be a bother... so I tried this
func greeting() { let greeting = Hello println(greeting) } greeting()
and now I get 'Your code could not be compiled'
swift_lint.swift:8:20: error: use of unresolved identifier 'Hello' let greeting = Hello
Thanks for any help ;)
John Salamon
515 PointsThis is really strange because this works fine for me in Xcode .....
func greeting() { let greeting = "Hello" println(greeting)
} greeting() greeting() greeting()
But it will not work on the treehouse site for the exercise???
Marcio Mello
7,861 PointsMarcio Mello
7,861 PointsI don't think you need the quotes (") inside the println function.