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 trialRaquel Silva
2,057 PointsDoes the order of the input (by the user) matter?
Does the order in which the numbers are input by the user matter? Let's say the user puts in a bottomNumber (the starting number) that is larger than the topNumber. So, for instance, the user types in 25 first, and then 10 after. Will this make a difference in the results? Or does the formula account for errors of this nature? How so?
1 Answer
Julian Aramburu
11,368 PointsHi Raquel! Of course this matters! If you ask your users to input a number first from 1 to 5 and then input some other number from 5 to 10 and they input lets say 7 and 15...you would have different results than expected. That's why you must add some kind of validation to your code in order to check if your users did input the desired numbers. Even further you must use validation and so in order to prevent your code from malicious code from some evildoers!