Core Function Values

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> Values( <array>, <flag> ) </pre> === Description === Create an array containing all VALUES from a Hash (Dictionary) === Parameters === ==== array ==== The array to use...")
 
m (1 revision)
 
(5 intermediate revisions by one user not shown)
Line 15: Line 15:
 
==== flag ====
 
==== flag ====
  
Optional; If the flag is above 0 then the *Array* values will be included also after the Hash (Dictionary) values.
+
Limiter
 +
 
 +
<pre>
 +
0 = Return all values (default)
 +
1 = Return all values (from string keys only)
 +
2 = Return all values (from numeric keys only)
 +
</pre>
  
 
=== Return Value ===
 
=== Return Value ===
Line 28: Line 34:
  
 
=== Example ===
 
=== Example ===
 
Print values from the hash only
 
  
 
<syntaxhighlight lang="sputnik">
 
<syntaxhighlight lang="sputnik">
 
my $array = array( "One" => "Cat", "Two" => "Fire", "Three" => "FoX", "Four" => "Water", "moo", "lol" );
 
my $array = array( "One" => "Cat", "Two" => "Fire", "Three" => "FoX", "Four" => "Water", "moo", "lol" );
 
my $Values = Values( $array );
 
my $Values = Values( $array );
foreach( $Values as $Value )
 
{
 
println( "Value: $Value" );
 
}
 
</syntaxhighlight>
 
 
Print values from the hash AND the array (By setting the flag to 1)
 
 
<syntaxhighlight lang="sputnik">
 
my $array = array( "One" => "Cat", "Two" => "Fire", "Three" => "FoX", "Four" => "Water", "moo", "lol" );
 
my $Values = Values( $array, 1 );
 
 
foreach( $Values as $Value )
 
foreach( $Values as $Value )
 
{
 
{

Latest revision as of 12:37, 14 June 2015

Values( <array>, <flag> )

Contents

Description

Create an array containing all VALUES from a Hash (Dictionary)

Parameters

array

The array to use.

flag

Limiter

0 = Return all values (default)
1 = Return all values (from string keys only)
2 = Return all values (from numeric keys only)

Return Value

Success: A new array containing any/all values.

Failure: Returns empty array.

Remarks

None.

Example

my $array = array( "One" => "Cat", "Two" => "Fire", "Three" => "FoX", "Four" => "Water", "moo", "lol" );
my $Values = Values( $array );
foreach( $Values as $Value )
{
	println( "Value: $Value" );
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox