02.04.2017, 19:36
Allow me to de-structure your function
And that's what would happen in run-time, you have a loop although it will run only once, completely killing the purpose of the loop.
You can solve this by changing the value of the last return to 0, and removing the else statement and its contents. It'd look like this
PHP код:
function
{
loop start
{
check if car id is a cop car (loop number 1)
{
if so , stop the loop and the function itself and return 1;
}
if not
stop the loop and the function itself and return 0;
}
return 1; although you wont reach here anyway
}
You can solve this by changing the value of the last return to 0, and removing the else statement and its contents. It'd look like this
PHP код:
function
{
loop
{
check if the car is a cop car
{
if so, return 1;
}
}
if the loop above did not find any car, it did not stop the function, hence this return 0; will pass
}