Quote:
Between if statement and while statement. I don't know which which one to use.
Simple:
If you have one item to work on, you use
if
If you have a number of items to work on, you use
while
if
checks the condition once, and once only.
while
continues to loop until the condition is false.
if (myInteger == 666) Foo();
while (GetNextItem() == 666) Foo();