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 trialWilliam Shaylor
3,014 PointsFor YatzyScoresheet isn't it better to pass in property of a hand, instead of making method for each number list?
Why do we get asked to make a method for each property of hand? So score_ones, score_twos, score_threes, etc. So we need a separate method for hand.ones, hand.twos, hand.threes, etc..
Isn't it better to create just one method that accepts the properties of hand as arguments, and sums them instead? So instead of just passing 'hand' as an argument, we could for example pass in 'hand.fours' or 'hand.twos'. The way we're told to code it surely breaks the DRY rule?
1 Answer
Jebadeiah Jones
10,429 PointsThis is kinda tough when going back, but I suspect it's simply because they hadn't covered something at this point, specifically ranges.