Core Function List

From Sputnik Wiki
Revision as of 18:51, 13 August 2014 by UberFoX (Talk | contribs)
Jump to: navigation, search
<Scope> List( <expressions>, .. ) = <array>
<Scope> List( <expressions>, .. ) += <array>
<Scope> List( <expressions>, .. ) *= <array>
...

Contents

Description

Extract some elements from an array into ready to use variables.

Optionally can be used as += etc.

Scope

Optional; Can be nothing or can be "my" (without quotes)

Choices:

my - The local scope

global - The global scope

expressions

A list of variables to be created separated by ,

array

The array to use

Return Value

None

Remarks

The default scope will be "my" ie LOCAL scope only.

You may add "my" anyway just to future proof your code should the default ever change....

You can use Global if you want the variables to be accessible by everything anytime.

Example

my $Accounts = array();
$Accounts[] = array("John", 1111);
$Accounts[] = array("Smith", 2222);
 
foreach($Accounts as my $Account)
{
	my List( $Name, $Password ) = $Account;
	println( "Name '$Name' Password '$Password'" );
}

Example of using +=

// Of course it can use all the operators
// but for this example we just use +=
my $a = 10;
my $b = 20;
 
List ( $a, $b ) += array(5, 5);
 
say $a; // 15
say $b; // 25
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox