which is a better idea?
for(blah blah blah)
code stuff
if(blah)break
or
do
code stuff
while(blah)
im pretty sure you can get the desired result either way, which is betteR?
ID:153281
Jul 19 2004, 1:13 pm
|
|
In response to Jon88
|
|
Jon88 wrote:
First, BYOND doesn't have do loops. Yes it does. do-while loops are perfectly valid. Second, use of for() or while depends entirely on the situation. Certain situations can favour the use of one over the other. I think what he was asking was if it was better to use an if() to break out of a for(). And the answer is no, usually not. Use the loop's own condition if you can. Lummox JR |
In response to Jon88
|
|
what do you mean it doesnt have do loops
|
In response to Siefer
|
|
He's wrong. Ignore him. ;-)
|
First, BYOND doesn't have do loops.
Second, use of for() or while depends entirely on the situation. Certain situations can favour the use of one over the other.