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 trialArihant Banthia
3,950 PointsDidn't understand the question
What is being asked to do in this question
package clock
type Clock struct {
Hours int
Minutes int
}
// DEFINE A "Noon" FUNCTION HERE
func Noon(t *Clock) Clock {
r:=Clock{}
r.Hours=12
r.Minutes=0
return r
}
1 Answer
Bas Kuunk
21,308 PointsThe function should just return a Clock instance, which you do correctly, but it should not take any input. They ask for a regular function in the package, not a method on the type.
Remove the inputs and replace the body of the function as per the following:
func Noon() Clock {
return Clock{12, 0}
}
Antoine Solomon
2,850 PointsAntoine Solomon
2,850 PointsDo you need that argument to the Noon function? After all you are initializing the r variable to a new instance of Clock and eventually returning r