Lasso Soft Inc. > Home

[ map->get ]


[map->get] returns value associated to a key from the map. Accepts a single parameter which is the key of the key/value pair of the map element.

This method is similar to the [map->find] method, but it is more strict in that if the map does not contain a key then [map->get] throws an error while [map->find] would just return [void]

Note: This method does not work in the same way as the similarly named [map->get] tag of previous versions of Lasso™

  • Syntax
  • Beginner

To get each of the values of a map:

Use the [map->get] method.  The following code loops through the map displaying each value.


var (colours = map( 'red'='#ff0000', 
    'blue'='#0000ff') )

 with i in $colours->keys 
     do => {^



Calling the method with an unknown key

If you pass a value to [map->get] that is not a key in the map, then a failure will be raised.


var(my_map) = map('moose'='yuk', 'elk'='yum', 'croc'='chicken')



-9956 The key was not found

Recent Comments

No Comments found

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