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 trialKshatriiya .
1,464 PointsA quick question on (char letter : mAnswer.toCharArray())
hi could you explain in a very simple term what this method does?
(char letter : mAnswer.indexOf(letter))
I understand that mAnswer.toCharArray() breaks mAnswer into separate letters but what does "char letter:" do?
and this bit
char display = '-'
Does it just store an empty char variable?
1 Answer
Seth Kroger
56,413 PointsIt's declaring a variable that will exist inside the loop. In each step of the loop, it will hold the individual char from the char array.