Core Function Return

From Sputnik Wiki
Jump to: navigation, search
Return <expressions>

Contents

Description

Immediately ends execution of the current function, and returns its argument as the value of the function call. return will also end the execution of an Eval() statement or script file

expressions

The expressions to return from the function can be a single variable or even arrays.

This can also just be nothing like

return;

Return Value

You decide.

Remarks

None.

Example

A simple numeric return

$value = Add(10, 20);
 
println("Value is $value"); // Prints 30
 
Function Add($a, $b)
{
	return $a + $b;
}

Return an array

List( $Name, $ID ) = Test("UberFoX", 777);
 
println("Name: $Name | ID: $ID");
// Prints Name: UberFoX | ID: 777
 
Function Test( $Name, $ID )
{
	return array($Name, $ID);
}


Return nothing

$value = Test();
 
println("Value is $value"); // Prints 30
 
Function Test($a, $b)
{
	my $Test = $a;
	my $foo = "Bar";
	return;
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox