Return Statements
#1

I'm a beginner at Pawn, I don't understand what the return statements are used for. Can anyone explain them to me alongside with some examples of there use.
Basically, I don't understand the purpose of them and I have no idea when I would use return 1; or return 0; If anyone could clear this up for me, it would be very much appreciated!
Reply
#2

https://sampwiki.blast.hk/wiki/Keywords:Statements
Reply
#3

Quote:
Originally Posted by M4z
View Post
I'm a beginner at Pawn, I don't understand what the return statements are used for. Can anyone explain them to me alongside with some examples of there use.
Basically, I don't understand the purpose of them and I have no idea when I would use return 1; or return 0; If anyone could clear this up for me, it would be very much appreciated!
The return statement ends a function and sets the result of the function. It
need not appear at the very end of the function; early exits are permitted.

A function can only have a single return value —that is, a return statement in a function
may only contain one expression.

If a function has one output value, you typically use a return statement; if a function has
more output values, you use reference arguments.

http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)