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 trialJuan Llano
Full Stack JavaScript Techdegree Student 481 PointsWHILE LOOP QUESTION
Towards the end of the video, why does Craig put while tickets_remaining >=1: instead of putting while tickets_remaining >0:? Thank you in advance.
2 Answers
Steven Parker
231,275 PointsThe functionality would be identical with either code choice. There will often be more than one valid way to code something, and it's "programmer's choice". He may have chosen that intentionally because he felt it conveyed the purpose of the code better, or it might just have been the first thing he thought of.
Perhaps if we tag him here, Craig Dennis will drop by and let us know!
Luke Maschoff
820 PointsTo add on to Steven, in a programmers view, it seems much nicer to say, "greater than, or equal to 1" over saying, "greater than 0". It makes the code much easier to read, edit, and maintain.