Core Function Enumerate

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> Enumerate( <enum> ) </pre> === Description === Cycle through all Name + Values in an enum === Parameters === ==== enum ==== The enum to use. === Return Value === Suc...")
 
(Example)
Line 36: Line 36:
 
};
 
};
 
 
foreach( Enumerate("Countries") as $Country <=> $ID )
+
foreach( Enumerate("Countries") as $Country => $ID )
 
{
 
{
 
println("Enum item Name '$Country' Value '$ID'");
 
println("Enum item Name '$Country' Value '$ID'");

Revision as of 09:18, 11 August 2013

Enumerate( <enum> )

Contents

Description

Cycle through all Name + Values in an enum

Parameters

enum

The enum to use.

Return Value

Success: A hash containing Key/Values matching the Enums.

Failure: Returns nothing.

Remarks

None.

Example

enum Countries
{
	$England = 1,
	$France = 2,
	$Germany = 3,
	$Netherlands = 4,
	$Italy = 6,
	$Soviet = 7
};
 
foreach( Enumerate("Countries") as $Country => $ID )
{
	println("Enum item Name '$Country' Value '$ID'");
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox