[set->get(key)] returns an element of the set. Since sets exist entirely of keys, the key is provided and the key is returned if it is contained within the set. If the key does not exist within the set, a failure is generated.
set->get( test_value )
Use the [set->get] method. This example uses the [set->get] method to check a set for the presence of elements of an array.
Code
var( theWeek = set('Mon','Tue','Wed','Thu','Fri','Sat','Sun'),
myDays = array('Tue', 'Sat', '4th', 'Sun') )
with d in $myDays
do => {^
protect => {^
'My day '+ $theWeek->get(#d) +' is in the week\n'
^}
^}
Result
My day Tue is in the week My day Sat is in the week My day Sun is in the week
This method differs greatly from its Lasso 8.x counterpart the [set->get] tag which returned the element of a set found at a given position. Since the elements of Lasso9 set objects are unordered this functionality is not available.
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 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments