SA-MP Forums Archive
What would happen if... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What would happen if... (/showthread.php?tid=362441)



What would happen if... - Tee - 24.07.2012

...I don't allow a function to return a value?
Example:

pawn Код:
forward Loop();
public Loop()
{
    foreach(Player,i)
    {
        printf("There are %d players connected.",i);
    }
    //if I don't return a value here, what would happen?
}
Same thing for stock and normal functions.


Re: What would happen if... - FireCat - 24.07.2012

Nothing would happen, I guess


Re : What would happen if... - lelemaster - 24.07.2012

I think you'll have a warning.

EDIT: Why don't you compile and look what it gives you?


Re: Re : What would happen if... - Tee - 24.07.2012

I think I read somewhere functions should always return a value. And no, I won't receive warnings, I just want to be on the safe side.


Re: What would happen if... - Vince - 24.07.2012

Functions only need to return a value if that value is assigned or checked somewhere.


Re: What would happen if... - Tee - 24.07.2012

Okay, thanks much!