Can someone explain the differences between lessons 5/11 and 6/11?


#1

Basically what the title said. I had a heck of a time figuring out 5/11. But then it felt like the tables were turned on me when I got to 6/11. Why wasn't doing something similar to lesson 5/11 not acceptable? Did it have something to do with how many times the loop was supposed to run in 6/11?

Basically, why was it not acceptable to count up to one loop in the same manner we counted up to three loops in 5/11?


#2

If you do the same thing each time, you don't learn different ways to use the loop. Exercise 5 uses a counter, so the loops run x times, which is very useful. In exercise 6 we use true and false. The scenario in exercise 6 is also very useful, lets say we prompt the user for input, then validate it until the user gives us valid input. How many times do we have to run the loop? We don't know, so a counter is very unpractical, while true and false is very useful, it will just prompt as many times as needed till user gives valid input


#3

Thank you, that explanation made it clear. I wasn't thinking about how it applied outside of the lesson. I was sure I was doing it right, but when it wouldn't pass I became confused. Came here and saw people had a much different answer than what I was thinking, but I didn't know why.


#4

You didn't have to think about something outside the lesson, but it thought it was a beautiful example to indicate the difference. Some lessons allow for multiply solutions.