Quote:
Originally Posted by GoldenLion
wiki says "The use of gotos is widely discouraged due to their effect on program flow."
|
Because it can be replaced with do-while in a lot of cases. The main difference between while and do-while being that do-while always executes at least once because the comparison comes after the loop.
PHP код:
new randModel, guard;
do
{
randModel = minrandom(400, 611);
}
while(!isACar(randModel) && ++guard < 100);
Something like that. The "guard" is there so the loop doesn't run potentially infinitely.