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 trialBarry Maloney
2,583 Pointsnamed_parameters challenge 2 confusion
Seem to be stumped again on a challenge. First I tried using the [ -> String ] but that didn't work either.
named_parameters.swift
1 let person = "Jerry" 2 func greeting(#person: String) { 3 return greeting(person: "Jerry") 4 }
let person = "Jerry"
func greeting(#person: String) {
return greeting(person: "Jerry")
}
2 Answers
Vrund Patel
11,994 PointsHope this helps.
func greeting(#person: String) {
println("Hello \(person)")
}
greeting(person: "Jerry")
Barry Maloney
2,583 Pointsthanks. It seems so logical now. I didn't realize I should keep the println command, although now I see it says to always add the code to what's already there. And rather than storing "Jerry" value as a constant you can eliminate code by calling it within the function. Just like the lesson was trying to point out. Duh!
Vrund Patel
11,994 PointsI am glad that it helped you.