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 trialJoshua Villaruz
2,842 PointsWhy the method is void load? not int load?
i wish my question is valid hehehe i'm confused. the variable that you will store in load is an integer right?
1 Answer
Jeremy Faith
Courses Plus Student 56,696 PointsAlthough the method is setting variable mPezCount with a constant MAX_PEZ (which are integers), the method does not return a value. So in the method declaration you need to use void which indicates there will be no return value. Had you wanted to return mPezCount then you would have used int in the method declaration.
Joshua Villaruz
2,842 PointsJoshua Villaruz
2,842 Pointsthank you si Jeremy!
Harley Urquhart
26,203 PointsHarley Urquhart
26,203 PointsJoshua you should probably mark this as best answer as it would be nice :) i upvoted and this is true for other programming languages that are void of a return type