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 trialJonathan Ankiewicz
17,901 PointsI have no idea what I am doing
for the life of me, I can't understand what they are asking?
Just return a value, write functions that process minutes and hours and then feed it time to return a value time of noon?
package clock
type Clock struct {
Hours int
Minutes int
}
// DEFINE A "Noon" FUNCTION HERE
func Noon (c Clock) {
c := Clock{}
c.Hours = 12
c.Minutes = 0
return c
}
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! Your function does not need a parameter, but will need a return type. Also, you can set the values of the fields simultaneously while creating an instance of the struct. This is how I did it:
func Noon() (Clock) {
c := Clock{12, 0}
return c
}
Hope this helps!