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 trialDinu Comendant
6,049 PointsWhy hits and misses are not considered as parameters?
No matter how many times I come across explanations about parameters, it still confuses me. Why hits and misses are not considered as parameters?
2 Answers
<noob />
17,062 Pointsu want to use parameters when u want to have a dynamic variable to store different results. i donβt use hits and misses as a parameter because u donβt want to initializ them every time like the answer , u want to add values to them , as far as i know
Ian Bonyun
4,645 PointsParameters are for user input, stuff that the method doesn't already know. The hits and misses attributes are not user input. They are part of the Game object's state and are already within its scope, which means applyGuess() can access them directly. Passing them as parameters is certainly possible, but would be redundant.