whats the point of return
#6

For the callbacks, just read the given documentation (https://sampwiki.blast.hk/wiki/Scripting_Callbacks)

For the functions, it's just like in C. If you need to return something useful in a function, then return it.
Else, just don't return anything anywhere (using "return;" returns also nothing).

At last but not least : once you used "return" somewhere in your code, if this "return" is accessed run-time, then the program won't go forward.

For example :

pawn Код:
myFunc(...)
{
      if(numargs() == 0) // If no arguments passed
            return; // Exit the function
      if(getarg(0) == 13) // If the first argument's value is 13 (we can do it because we are sure the user have entered at least an argument with the condition above.
            printf("The first argument is 13 !"); // print a message
}
Reply


Messages In This Thread
whats the point of return - by Bondage - 31.10.2014, 20:32
Re: whats the point of return - by Vince - 31.10.2014, 21:10
Re: whats the point of return - by Bondage - 31.10.2014, 21:30
Re: whats the point of return - by sammp - 31.10.2014, 22:42
Re: whats the point of return - by Pottus - 31.10.2014, 22:59
Re : whats the point of return - by S4t3K - 01.11.2014, 02:53

Forum Jump:


Users browsing this thread: 1 Guest(s)