A pair is an object that holds two values. Pairs are often used to represent name/value pairs so the first element is often referred to as the name and the second element is referred to as the value.
Pairs can be used to hold any data type including decimals, integers, strings, maps, arrays, other pairs, etc.
Pairs are returned by many LDML tags. The [Action_Params] tag returns an array of pairs representing the parameters of the current Lasso action. The [Map->Get] tag always returns a pair representing the key and value of a particular map element.
A pair can be created explicitly using the [Pair] tag. An empty pair can be created using [Pair] as in [Variable: 'myPair' = (Pair)] or the elements of the new pair can be set explicitly as in [Variable: 'myPair' = (Pair: 'first'='second')].
Pairs are created implicitly when defining or inserting elements into arrays. [Variable: 'myArray' = (Array: 1='one')] will create an array containing one pair. [$myArray->(Insert: 2='two')] will insert a pair into the array.
See the descriptions of the pair member tags [Pair-First] and [Pair->Second] for examples of how to retrieve pair elements or set them.
[Variable: 'myPair' = (Pair)] [Variable: 'myPair' = (Pair: 'name'='value')]
See the Lasso 8 Language Guide for examples of how to use this tag.
|Tag Link||Pair||Category||Data Type|
|Type||Data Type||Data Source||Any|
|Implementation||Internal||Sets||Lasso 6.0, Lasso 5.0|
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.