Hey,
When exactly do I use these statements to break out of a loop, or to another point in the loop?
What I mean is, I've already done several exercises in my book for while loops, do loops, and for loops, and I haven't used a statement to break the loop yet.
As far as I can see, the condition that tests is what has been determining whether to continue looping, or break from the loop. This has always worked, so when is using break, continue or goto worthwhile? Or is it just a different way to write the same thing, as I have seen there are many ways to write code, depending on who writes it and their style I suppose.
When exactly do I use these statements to break out of a loop, or to another point in the loop?
What I mean is, I've already done several exercises in my book for while loops, do loops, and for loops, and I haven't used a statement to break the loop yet.
As far as I can see, the condition that tests is what has been determining whether to continue looping, or break from the loop. This has always worked, so when is using break, continue or goto worthwhile? Or is it just a different way to write the same thing, as I have seen there are many ways to write code, depending on who writes it and their style I suppose.