Blockland Forums > Modification Help

Using return; to return info?

Pages: (1/3) > >>

Daenth:

I've seen many script use return [something]; in their script. Destiny told me that it returns information but did not go into details. So, I'm wondering what it does.

Kalphiter:

echo(returnasdfasoidfjao());

function returnasdfasoidfjao()
{
    return "returnasdfasoidfjao";
}

Daenth:


--- Quote from: Kalphiter on June 10, 2011, 08:30:06 PM ---echo(returnasdfasoidfjao());

function returnasdfasoidfjao()
{
    return "returnasdfasoidfjao";
}

--- End quote ---
Err, worded my post wrong.
What does it do?

Red_Guy:

example:


function go()
  {
   %var = myFunction(8);
   echo("var = " @ %var);
  }

function myFunction(%stuff)
  {
   %value = %stuff + 2;
   return %value;
   (or just:    return %stuff + 2; )
  }


then in the console you say:
go();
and get back:
var = 10

-or

echo(myFunction(2));
and get back:
4


Daenth:


--- Quote from: Red_Guy on June 10, 2011, 08:37:31 PM ---example:


function go()
  {
   %var = myFunction(8);
   echo("var = " @ %var);
  }

function myFunction(%stuff)
  {
   %value = %stuff + 2;
   return %value;
   (or just:    return %stuff + 2; )
  }


then in the console you say:
go();
and get back:
var = 10

-or

echo(myFunction(2));
and get back:
4


--- End quote ---
Huh, but where would you use this?

Pages: (1/3) > >>

Go to full version