Quick question about a loop
#1

What effect would there be for placing a return 1 in a loop? Would that stop the loop? Would return 0 have the same effect?
Reply
#2

pawn Код:
return 1;
tells the function / command that it has completed. This is turn, stops the loop (or if after the loops closing bracket, the rest of that specifc function/command)

pawn Код:
return 0;
however, tells the function / command that it failed to complete, and passes it to other scripts.
Reply
#3

Returning a value stops the whole callback. Example:
pawn Код:
OnPlayerEnterInterior([...])
{
if(Bleh==32)return 1;
print("Won't printed if Bleh=32.");
return 1;
}
pawn Код:
OnPlayerEnterInterior([...])
{
if(Bleh==32)return 1;
else return 0;
print("Won't printed (never).");
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)