# BJP4 Self-Check 5.8: doWhileLoops

+17 votes

In part f, why do we still count when the word length > 10?

asked

## 2 Answers

+8 votes

Not exactly sure what you mean by, "count". If you mean go through the loop, then the answer is that if does not go through the loop when word length > 10.

answered by (1 point)
+3

I did. So the word "bbbbabbbb", the word length is 9 and the count is up to 4. I thought it should end there but i keep continue "bbbbbabbbbb", which the word length is 11 and it still count up to 5.

+4

I think you are forgetting about the first time it goes through the loop when the word is "a"

+3

When the word length is 9, it has gone through the loop 5 times.

+2

But if count "a" = 1, then should it loop 6 times because it still count the last word "bbbbbabbbbb"?

+2

No, it will not go through the loop when the word is, "bbbbbabbbbb"?

+2

But as I review the slide from the class, the example number <50, the output is number 80. So it still goes through do while loop ?

+2

Yes, the OUTPUT is 80, just like in the program the WORD would be, "bbbbbabbbbb" but the number of time that it goes through the loop is 5 in Practice.It. As soon as the while loop is false, the loop stops.

+7 votes

oh I got it. Thank you.

answered by (1 point)