Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
returning values (return command)
RaideX Offline
Member

Posts: 212
Threads: 33
Joined: May 2013
Reputation: 7
#3
RE: returning values (return command)

(01-02-2014, 09:36 PM)Amn Wrote: In that case, return is used to prevent the code from reading the rest of the code. It stops and continues at the parent function that called it.

If you had your function declared as string or whatever instead of void, you could return data of that type by using return value


PHP Code: (Select All)
string Message () 
{    
     return 
"hello";




At least that's how I use it and works as expected.
No idea if here has another use other than that.

i'm not quite getting the part with the "stops reading the code". What exactly would be the difference here? I mean, the whole code in the brackets is going to be executed no matter if it returns it or not.

I think i'll need some more examples on the first bit. The second one is quite self explanatory.

If you don't draw first, you don't get to draw at all... -The False Shepherd
01-02-2014, 09:56 PM
Find


Messages In This Thread
returning values (return command) - by RaideX - 01-02-2014, 07:35 PM
RE: returning values (return command) - by RaideX - 01-02-2014, 09:56 PM
RE: returning values (return command) - by Javist - 01-03-2014, 09:34 AM



Users browsing this thread: 1 Guest(s)