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 trialPranava Varshan
3,082 PointsDeclaring _path as a MapLocation[] type
Should have asked this buy anyway .
How can _path be declared a MapLocation[] ???
Integer has a range . -2,147,483,648 to 2,147,483,647. So integer accept integers form that range.
What does MapLocation[] accept and its range ???
1 Answer
Steven Parker
231,275 PointsI'm not sure what your first question is asking. A variable can be declared as any possible type. So "_path" is declared as an array of MapLocation objects.
But MapLocation[] accepts a collection of MapLocation objects, and each one contains inside it two integers named "X" and "Y". Both of these have the value range that you indicated. But the practical range is much smaller, as it must be within the limits of the map argument passed when the instance is created.