Lasso Soft Inc. > Home

[ set->find ]

Method

[set->find] searches the set for the parameter and returns a set element which matches. Accepts a single parameter of any data type including matchers. If no elements in the set match the parameter to the [set->find] method then the return value is void

This method is particularly useful when the set is a set of pairs, in which case the name of the name/value pair is compared to the search parameter.

  • Syntax
set->find( search_term )
Examples
  • Beginner

To return the name/value pair with a given name from a set of pairs

Use the [set->find] method. This example returns the pair whose "name" is 'Mon' from a set of day/person pairs.

Code

var( workSchedule = set('Mon' = 'Jono', 'Tues'='Sean', 'Wed'='Jess', 'Thur'='Eric', 'Fri' ='Jordon', 'Sat'='Jono','Sun'='Jono') )

var( aDay = $workSchedule->find('Mon') )

$aDay->second+' is working on Monday'

Result

Jono is working on Monday

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