Lasso Soft Inc. > Home

[ map ]

Method

The [map] method is used to cast an object to the map type.

This method may be used without parameters to create an empty map object. Alternatively the method accepts a list of comma-separated key/value pairs in the format key = value to populate the map at creation.

The keys and values may be of any type.

  • Syntax
  • Methods
  • Traits
map( key_1 = value_1, key_2 = value_2, ..., key_n = value_n )
Has methods:
Examples
  • Beginner

To create a map from integers to days of the week:

Use the [map] method with name/value pairs for each of the names of the days of the week as parameters. The following example stores a map which maps integers to the names of the days of the week in a variable named DaysOfTheWeek.

Code

var( DaysofTheWeek = map(0='Sunday', 1='Monday', 2='Tuesday', 3='Wednesday', 4='Thursday', 5='Friday', 6='Saturday') )

$DaysOfTheWeek

Result

map(0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday)

Recent Comments

Be aware that maps are not stored in any sort of predictable order. If the order is important, use an array instead.

Posted on: 26 February 2013

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft