Do While will execute the command first before checking for condition. Advantage is when you know you will have a constant command in the 1st iteration.
While will execute the command after checking for condition.
U mean vs For loop?
While loop could save you 75% to 88% memory bytes vs For loop, esp. in situation where you use boolean datatype for the while loop condition. Remember boolean is a very inexpensive datatype, only contains bits 0 and 1 (1 byte). For loop typically uses integer for index cursors, with increment and decrement, more expensive than boolean (int is 4 bytes, longint is 8 bytes).
Think of it this way. For loop is better when you know how many iterations you're gonna go through. While loop is better is you are unsure how many iteration to go.
1 byte vs 4 or 8 bytes might sound small but in a situation where u use many vars, it could make big difference.
That's all I can think of. I might be wrong, correct me if i am, my memory is kinda rotten lolz...
@iSaintx: Go
What do you mean? Do While vs While?
Do While will execute the command first before checking for condition. Advantage is when you know you will have a constant command in the 1st iteration. While will execute the command after checking for condition.
U mean vs For loop? While loop could save you 75% to 88% memory bytes vs For loop, esp. in situation where you use boolean datatype for the while loop condition. Remember boolean is a very inexpensive datatype, only contains bits 0 and 1 (1 byte). For loop typically uses integer for index cursors, with increment and decrement, more expensive than boolean (int is 4 bytes, longint is 8 bytes).
Think of it this way. For loop is better when you know how many iterations you're gonna go through. While loop is better is you are unsure how many iteration to go.
1 byte vs 4 or 8 bytes might sound small but in a situation where u use many vars, it could make big difference.
That's all I can think of. I might be wrong, correct me if i am, my memory is kinda rotten lolz...