Core Function Walk

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
UberFoX (Talk | contribs)
(Created page with "<pre> Walk( <function>, <array> ) </pre> === Description === Walk through the arrays items and execute a user defined function on each one. === Parameters === ==== function =...")
Newer edit →

Revision as of 12:53, 22 January 2013

Walk( <function>, <array> )

Contents

Description

Walk through the arrays items and execute a user defined function on each one.

Parameters

function

A user defined function literal or variable containing one.

array

The array to use.

Return Value

Success - Returns unknown.

Failure - Returns 0.

Remarks

None.

Example

my $myarray = array(10, 20, 30, 40, 50, 60, 70);
$ret = Walk(function($value){$value++;}, $myarray);
println("Walk returned: $ret");

Same as above

my $myarray = array(10, 20, 30, 40, 50, 60, 70);
 
my $func = function($value)
		{
			println("Got value $value adding to it now...");
			$value++;
		};
 
 
$ret = Walk($func, $myarray);
println("Walk returned: $ret");
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox