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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Gaurang Kotasthane](https://secure.gravatar.com/avatar/26cbde531f2a9b2f5448bfab8dd89d8b?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Gaurang Kotasthane
1,394 Pointsreturn choice -1
I did not understand why we returned choice as -1 any help would be appreciated thanks
1 Answer
![Matthias Margot](https://secure.gravatar.com/avatar/cb39283755caf6fa00c133e70e505190?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Matthias Margot
7,236 PointsYou know how in the console user interface the artists and songs to choose from are ordered from 1 to (total number of artists)? This is starting at '1' problem is indices (plural of index) in coding start at 0. So if you choose the seconds artist your choice is '2' but the index of the artist in the ArrayList (or whatever collection you're using, been a while since i watched that video, might be a map don't remember) is actually not '2' but 2 - 1 which is '1'. The second entry in your list has the index '1' because the first entry has the index '0' so that's why you take 1 away from choice.
Gaurang Kotasthane
1,394 PointsGaurang Kotasthane
1,394 Pointsoh now it makes sense!