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 trialCory Cox
570 PointsHow do I print out the value of the language element from the result tuple using a print line?
Really have no clue at this point. What i have so far outside the last }
var result = (greeting)
println(language)
not really sure what else to add in the print line statement. Please help!!
1 Answer
Pavel Fomchenkov
20,897 PointsIt is not clear from your code, but I suppose you want to extract a value of a tuple part.
// Sample tuple
let someStringTuple = ("one", "two", "three")
// Extracting subvalues
let (str1, str2, str3) = someStringTuple
// Printing out the 1st part
println(str1)
// Printing out the 2nd and 3rd parts
println("2nd: \(str2), 3rd: \(str3)")