My heavily comment-explained For/For/If/If loop nest, exactly the same as the instructors', if it helps anybody

Apologies for the long, tiny lines of comments but just thought I’d share this.

After watching Lecture 38 through 40 about ten times by now, fixing the bug(why oh why did they decide THIS nested nightmare was the appropriate place to introduce a bug on top of everything else; made it far harder to learn the If loop logic), reading other breakdowns, etc, I feel like I can finally wrap my head around each line of the algorithm here, what they’re doing and why it works.

I’d been unsatisfied with my shaky understanding of the nested loops here, index[#] calls, character comparisons etc. and wasn’t happy to be just brushing past this when it’s kind of the entire heart of the game and what makes it work, and most of the other solutions here seem to involve people having come up with their own loops which deviate from the course(nothing wrong with that other than lack of continuity when moving ahead).

Anyway, hopefully my comment lines here are a helpful breakdown for the next person like me feeling like they’ve totally lost the plot at this step and wondering if they’ll ever be able to follow what’s next.

3 Likes

Privacy & Terms