Lasso Soft Inc. > Home

[ map->insert ]


The [map->insert] inserts a value into the map for a specified key. Accepts a single name/value parameter which is the name of a key in the array and the value that should be stored for that key. If desired a single value may be passed as a parameter to the method. In this case the value will be treated as a key with an empty value, essentially acting as a placeholder in the map.

Keys and values can be of any data types.

Note: This method will replace an item in the map with the same key. Each map can only store one value for each key.

  • Syntax
map->insert( key = value )

map->insert( placeholder_key )
  • Beginner

To store a value in a map for a given key:

Use the [map->Insert] method.

The following example:

  • adds a new color 'black' to the 'colours' map with an appropriate HTML color code as the value.
  • adds a placeholder is added to the map for the colour 'magenta'
  • updates the value for the colour 'grey'


var (colours = map( 'red'='#ff0000',
                     'green' = '#00ff00',
                     'blue' = '#0000ff',
                     'grey' = '#aaaaaa') )

$colours->insert( 'black' = '#000000' )

$colours->insert( 'magenta' )

$colours->insert( 'grey' = '#ababab' )



map(black = #000000, blue = #0000ff, green = #00ff00, grey = #ababab, magenta = , red = #ff0000)

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