what is the main differences between the two loops,
and when is one better to use then the other?
so far I have fallen in love with if statements..........they seem easier, and
all I know about a while loop is that it is used when you need the loop to run at least once.
I hate our book for class it gives more questions they answers.
what are code tags? do they mean html code? is there somewhere to get which codes are legal?
It is unusual to describe the if statement as a kind of loop.
The statements following an if are executed exactly once if the if statement is true,
The statements following a while are executed over and over for as long as the while statement remains true.
A while loop may not run, even once.
- int nyet = 0;
-
while ( nyet ) {
-
... // this will not execute
-
}
I am sorry you hate your class book. Since there are lots of places to find answers, but good questions are hard to find, you should try answering some of those questions.
I do not know what code tags are either, not without some context.