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
Jonathan Dueck
4,596 PointsI keep getting the same error.
I'm sure I'm missing something stupid here... Help?
2 Answers
Ben Griffith
5,808 PointsWhich task are you stuck on?
In the first task you must make 2 modifications.
First step is to specify that you're returning a tuple with 2 strings, greeting and language, instead of just a single string.
// Before
func greeting(person: String) -> String {
// After
func greeting(person: String) -> (greeting: String, language: String) {
Second step is to change the actual return value so that you're returning a tuple instead of just a string
// Before
return greeting
// After
return (greeting, language)
Jonathan Dueck
4,596 PointsFound it.
Question One
func greeting(person: String) -> (greeting:String, language:String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
Question Two
func greeting(person: String) -> (greeting:String, language:String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
var result = greeting("Tom")
Question Three
func greeting(person: String) -> (greeting:String, language:String) {
let language = "English"
let greeting = "Hello \(person)"
return (greeting, language)
}
var result = greeting("Tom")
println(result.language)