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 trialyeoyeon kim
2,586 Pointsfill(int pezAmount) method
instead of - int newAmount = pezCount + pezAmount; if (newAmount > MAX_PEZ) {}
can you do - this.pezCount += pezAmount; if (this.pezCount > MAX_PEZ) {}
are they both the same thing ?
1 Answer
Phoenix S.
2,456 PointsSo this is probably irrelevant to you now but I ran the code myself and as long as you remember to change the 'newAmount' name everywhere used within the PezDispenser class, looks like you're good to go.
Now as far as if convention wise that may not be the best way to do it, but I'm not qualified to say it's okay or not okay, but now we know it does in fact work.