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 trialhandsome nguyen
330 PointsFor Loop question
"For month in months..."
If the "months" is a constant or variable that you are trying to create a for loop condition for, then what does the "month" represent? Is it an arbitrary name or a key? Whats the purpose for having this?
1 Answer
Farhad Mohammad Afzali
5,007 Pointsmonth is the variables which incremented everytime the loop iterates. Its starting value is the lowest value of months array and ending value the highest of the mentioned array. So, it is used to iterate through the array values.
Hope it helps
Malerie Anderson
4,941 PointsMalerie Anderson
4,941 PointsI believe month is a variable, as it is the number used each time the for loop is executed. Month is an arbitrary name, but convention says that it should be the singular version of whatever you are iterating through.