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 trialYannick Van Dyck
1,297 PointsHi I was wondering how it comes that in the lettergame from te first letter all the '_' are printed...
Hi
I was wondering why in the lettergame from the first letter all the '' are printed from the word. I was thinking that this is because the for loop. But it's an else statement.. So I'm a bit confused about the '' Can somebody help me?
grtz Yannick
2 Answers
gyorgyandorka
13,811 PointsHi Yannick!
The whole if/else block is inside the for
loop. We are iterating through the letters of our secret word, and for each letter we do that condition check (if...
) to decide whether to print it to the screen (if we've already guessed that letter correctly), or (else...
) print an underscore instead (not among the correct guesses yet).
Yannick Van Dyck
1,297 PointsThank you for the reply Gyorgy ! Now I understand.. I have to work on developing my logical thinking, step by step...