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 trialDavid Rodriguez Saavedra
3,574 Pointsim stock in these activity
can anyone can help me with these
struct Expense {
var description: String
var amount: Double = 0.0
init (description: String) {
self.description = description
}
func calculateTaxes(percentage: Double){
return "\(self.amount) * \(percentage/100.0)"
}
}
1 Answer
mattlebl
10,849 PointsI have a feeling you are having trouble with the "Add a Double as a return type" instruction. In Swift, return types are defined with a dash, and then a greater than sign, making a sort of arrow: "->" This is what it looks like implemented:
func calculateTaxes(percentage: Double) -> Double /* ADDED THIS */ {
return self.amount * (percentage/100.0)
}
You'll also notice I removed the quotes. You were returning a string, we needed to return a Double instead.